
kernel：     文件格式 elf32-i386


Disassembly of section .text:

80100000 <multiboot_header>:
80100000:	02 b0 ad 1b 00 00    	add    0x1bad(%eax),%dh
80100006:	00 00                	add    %al,(%eax)
80100008:	fe 4f 52             	decb   0x52(%edi)
8010000b:	e4                   	.byte 0xe4

8010000c <entry>:

# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
  # Turn on page size extension for 4Mbyte pages
  movl    %cr4, %eax
8010000c:	0f 20 e0             	mov    %cr4,%eax
  orl     $(CR4_PSE), %eax
8010000f:	83 c8 10             	or     $0x10,%eax
  movl    %eax, %cr4
80100012:	0f 22 e0             	mov    %eax,%cr4
  # Set page directory
  movl    $(V2P_WO(entrypgdir)), %eax
80100015:	b8 00 a0 10 00       	mov    $0x10a000,%eax
  movl    %eax, %cr3
8010001a:	0f 22 d8             	mov    %eax,%cr3
  # Turn on paging.
  movl    %cr0, %eax
8010001d:	0f 20 c0             	mov    %cr0,%eax
  orl     $(CR0_PG|CR0_WP), %eax
80100020:	0d 00 00 01 80       	or     $0x80010000,%eax
  movl    %eax, %cr0
80100025:	0f 22 c0             	mov    %eax,%cr0

  # Set up the stack pointer.
  movl $(stack + KSTACKSIZE), %esp
80100028:	bc 00 65 11 80       	mov    $0x80116500,%esp

  # Jump to main(), and switch to executing at
  # high addresses. The indirect call is needed because
  # the assembler produces a PC-relative instruction
  # for a direct jump.
  mov $main, %eax
8010002d:	b8 88 38 10 80       	mov    $0x80103888,%eax
  jmp *%eax
80100032:	ff e0                	jmp    *%eax

80100034 <binit>:
  struct buf head;
} bcache;

void
binit(void)
{
80100034:	55                   	push   %ebp
80100035:	89 e5                	mov    %esp,%ebp
80100037:	83 ec 18             	sub    $0x18,%esp
  struct buf *b;

  initlock(&bcache.lock, "bcache");
8010003a:	83 ec 08             	sub    $0x8,%esp
8010003d:	68 88 84 10 80       	push   $0x80108488
80100042:	68 80 b5 10 80       	push   $0x8010b580
80100047:	e8 4c 4f 00 00       	call   80104f98 <initlock>
8010004c:	83 c4 10             	add    $0x10,%esp

//PAGEBREAK!
  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
8010004f:	c7 05 cc fc 10 80 7c 	movl   $0x8010fc7c,0x8010fccc
80100056:	fc 10 80 
  bcache.head.next = &bcache.head;
80100059:	c7 05 d0 fc 10 80 7c 	movl   $0x8010fc7c,0x8010fcd0
80100060:	fc 10 80 
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100063:	c7 45 f4 b4 b5 10 80 	movl   $0x8010b5b4,-0xc(%ebp)
8010006a:	eb 47                	jmp    801000b3 <binit+0x7f>
    b->next = bcache.head.next;
8010006c:	8b 15 d0 fc 10 80    	mov    0x8010fcd0,%edx
80100072:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100075:	89 50 54             	mov    %edx,0x54(%eax)
    b->prev = &bcache.head;
80100078:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010007b:	c7 40 50 7c fc 10 80 	movl   $0x8010fc7c,0x50(%eax)
    initsleeplock(&b->lock, "buffer");
80100082:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100085:	83 c0 0c             	add    $0xc,%eax
80100088:	83 ec 08             	sub    $0x8,%esp
8010008b:	68 8f 84 10 80       	push   $0x8010848f
80100090:	50                   	push   %eax
80100091:	e8 a5 4d 00 00       	call   80104e3b <initsleeplock>
80100096:	83 c4 10             	add    $0x10,%esp
    bcache.head.next->prev = b;
80100099:	a1 d0 fc 10 80       	mov    0x8010fcd0,%eax
8010009e:	8b 55 f4             	mov    -0xc(%ebp),%edx
801000a1:	89 50 50             	mov    %edx,0x50(%eax)
    bcache.head.next = b;
801000a4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000a7:	a3 d0 fc 10 80       	mov    %eax,0x8010fcd0
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
801000ac:	81 45 f4 5c 02 00 00 	addl   $0x25c,-0xc(%ebp)
801000b3:	b8 7c fc 10 80       	mov    $0x8010fc7c,%eax
801000b8:	39 45 f4             	cmp    %eax,-0xc(%ebp)
801000bb:	72 af                	jb     8010006c <binit+0x38>
  }
}
801000bd:	90                   	nop
801000be:	90                   	nop
801000bf:	c9                   	leave  
801000c0:	c3                   	ret    

801000c1 <bget>:
// Look through buffer cache for block on device dev.
// If not found, allocate a buffer.
// In either case, return locked buffer.
static struct buf*
bget(uint dev, uint blockno)
{
801000c1:	55                   	push   %ebp
801000c2:	89 e5                	mov    %esp,%ebp
801000c4:	83 ec 18             	sub    $0x18,%esp
  struct buf *b;

  acquire(&bcache.lock);
801000c7:	83 ec 0c             	sub    $0xc,%esp
801000ca:	68 80 b5 10 80       	push   $0x8010b580
801000cf:	e8 e6 4e 00 00       	call   80104fba <acquire>
801000d4:	83 c4 10             	add    $0x10,%esp

  // Is the block already cached?
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000d7:	a1 d0 fc 10 80       	mov    0x8010fcd0,%eax
801000dc:	89 45 f4             	mov    %eax,-0xc(%ebp)
801000df:	eb 58                	jmp    80100139 <bget+0x78>
    if(b->dev == dev && b->blockno == blockno){
801000e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000e4:	8b 40 04             	mov    0x4(%eax),%eax
801000e7:	39 45 08             	cmp    %eax,0x8(%ebp)
801000ea:	75 44                	jne    80100130 <bget+0x6f>
801000ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000ef:	8b 40 08             	mov    0x8(%eax),%eax
801000f2:	39 45 0c             	cmp    %eax,0xc(%ebp)
801000f5:	75 39                	jne    80100130 <bget+0x6f>
      b->refcnt++;
801000f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000fa:	8b 40 4c             	mov    0x4c(%eax),%eax
801000fd:	8d 50 01             	lea    0x1(%eax),%edx
80100100:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100103:	89 50 4c             	mov    %edx,0x4c(%eax)
      release(&bcache.lock);
80100106:	83 ec 0c             	sub    $0xc,%esp
80100109:	68 80 b5 10 80       	push   $0x8010b580
8010010e:	e8 15 4f 00 00       	call   80105028 <release>
80100113:	83 c4 10             	add    $0x10,%esp
      acquiresleep(&b->lock);
80100116:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100119:	83 c0 0c             	add    $0xc,%eax
8010011c:	83 ec 0c             	sub    $0xc,%esp
8010011f:	50                   	push   %eax
80100120:	e8 52 4d 00 00       	call   80104e77 <acquiresleep>
80100125:	83 c4 10             	add    $0x10,%esp
      return b;
80100128:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010012b:	e9 9d 00 00 00       	jmp    801001cd <bget+0x10c>
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
80100130:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100133:	8b 40 54             	mov    0x54(%eax),%eax
80100136:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100139:	81 7d f4 7c fc 10 80 	cmpl   $0x8010fc7c,-0xc(%ebp)
80100140:	75 9f                	jne    801000e1 <bget+0x20>
  }

  // Not cached; recycle an unused buffer.
  // Even if refcnt==0, B_DIRTY indicates a buffer is in use
  // because log.c has modified it but not yet committed it.
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100142:	a1 cc fc 10 80       	mov    0x8010fccc,%eax
80100147:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010014a:	eb 6b                	jmp    801001b7 <bget+0xf6>
    if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) {
8010014c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010014f:	8b 40 4c             	mov    0x4c(%eax),%eax
80100152:	85 c0                	test   %eax,%eax
80100154:	75 58                	jne    801001ae <bget+0xed>
80100156:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100159:	8b 00                	mov    (%eax),%eax
8010015b:	83 e0 04             	and    $0x4,%eax
8010015e:	85 c0                	test   %eax,%eax
80100160:	75 4c                	jne    801001ae <bget+0xed>
      b->dev = dev;
80100162:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100165:	8b 55 08             	mov    0x8(%ebp),%edx
80100168:	89 50 04             	mov    %edx,0x4(%eax)
      b->blockno = blockno;
8010016b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010016e:	8b 55 0c             	mov    0xc(%ebp),%edx
80100171:	89 50 08             	mov    %edx,0x8(%eax)
      b->flags = 0;
80100174:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100177:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
      b->refcnt = 1;
8010017d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100180:	c7 40 4c 01 00 00 00 	movl   $0x1,0x4c(%eax)
      release(&bcache.lock);
80100187:	83 ec 0c             	sub    $0xc,%esp
8010018a:	68 80 b5 10 80       	push   $0x8010b580
8010018f:	e8 94 4e 00 00       	call   80105028 <release>
80100194:	83 c4 10             	add    $0x10,%esp
      acquiresleep(&b->lock);
80100197:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010019a:	83 c0 0c             	add    $0xc,%eax
8010019d:	83 ec 0c             	sub    $0xc,%esp
801001a0:	50                   	push   %eax
801001a1:	e8 d1 4c 00 00       	call   80104e77 <acquiresleep>
801001a6:	83 c4 10             	add    $0x10,%esp
      return b;
801001a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001ac:	eb 1f                	jmp    801001cd <bget+0x10c>
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
801001ae:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001b1:	8b 40 50             	mov    0x50(%eax),%eax
801001b4:	89 45 f4             	mov    %eax,-0xc(%ebp)
801001b7:	81 7d f4 7c fc 10 80 	cmpl   $0x8010fc7c,-0xc(%ebp)
801001be:	75 8c                	jne    8010014c <bget+0x8b>
    }
  }
  panic("bget: no buffers");
801001c0:	83 ec 0c             	sub    $0xc,%esp
801001c3:	68 96 84 10 80       	push   $0x80108496
801001c8:	e8 e8 03 00 00       	call   801005b5 <panic>
}
801001cd:	c9                   	leave  
801001ce:	c3                   	ret    

801001cf <bread>:

// Return a locked buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
801001cf:	55                   	push   %ebp
801001d0:	89 e5                	mov    %esp,%ebp
801001d2:	83 ec 18             	sub    $0x18,%esp
  struct buf *b;

  b = bget(dev, blockno);
801001d5:	83 ec 08             	sub    $0x8,%esp
801001d8:	ff 75 0c             	push   0xc(%ebp)
801001db:	ff 75 08             	push   0x8(%ebp)
801001de:	e8 de fe ff ff       	call   801000c1 <bget>
801001e3:	83 c4 10             	add    $0x10,%esp
801001e6:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((b->flags & B_VALID) == 0) {
801001e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001ec:	8b 00                	mov    (%eax),%eax
801001ee:	83 e0 02             	and    $0x2,%eax
801001f1:	85 c0                	test   %eax,%eax
801001f3:	75 0e                	jne    80100203 <bread+0x34>
    iderw(b);
801001f5:	83 ec 0c             	sub    $0xc,%esp
801001f8:	ff 75 f4             	push   -0xc(%ebp)
801001fb:	e8 6e 27 00 00       	call   8010296e <iderw>
80100200:	83 c4 10             	add    $0x10,%esp
  }
  return b;
80100203:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80100206:	c9                   	leave  
80100207:	c3                   	ret    

80100208 <bwrite>:

// Write b's contents to disk.  Must be locked.
void
bwrite(struct buf *b)
{
80100208:	55                   	push   %ebp
80100209:	89 e5                	mov    %esp,%ebp
8010020b:	83 ec 08             	sub    $0x8,%esp
  if(!holdingsleep(&b->lock))
8010020e:	8b 45 08             	mov    0x8(%ebp),%eax
80100211:	83 c0 0c             	add    $0xc,%eax
80100214:	83 ec 0c             	sub    $0xc,%esp
80100217:	50                   	push   %eax
80100218:	e8 0c 4d 00 00       	call   80104f29 <holdingsleep>
8010021d:	83 c4 10             	add    $0x10,%esp
80100220:	85 c0                	test   %eax,%eax
80100222:	75 0d                	jne    80100231 <bwrite+0x29>
    panic("bwrite");
80100224:	83 ec 0c             	sub    $0xc,%esp
80100227:	68 a7 84 10 80       	push   $0x801084a7
8010022c:	e8 84 03 00 00       	call   801005b5 <panic>
  b->flags |= B_DIRTY;
80100231:	8b 45 08             	mov    0x8(%ebp),%eax
80100234:	8b 00                	mov    (%eax),%eax
80100236:	83 c8 04             	or     $0x4,%eax
80100239:	89 c2                	mov    %eax,%edx
8010023b:	8b 45 08             	mov    0x8(%ebp),%eax
8010023e:	89 10                	mov    %edx,(%eax)
  iderw(b);
80100240:	83 ec 0c             	sub    $0xc,%esp
80100243:	ff 75 08             	push   0x8(%ebp)
80100246:	e8 23 27 00 00       	call   8010296e <iderw>
8010024b:	83 c4 10             	add    $0x10,%esp
}
8010024e:	90                   	nop
8010024f:	c9                   	leave  
80100250:	c3                   	ret    

80100251 <brelse>:

// Release a locked buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
80100251:	55                   	push   %ebp
80100252:	89 e5                	mov    %esp,%ebp
80100254:	83 ec 08             	sub    $0x8,%esp
  if(!holdingsleep(&b->lock))
80100257:	8b 45 08             	mov    0x8(%ebp),%eax
8010025a:	83 c0 0c             	add    $0xc,%eax
8010025d:	83 ec 0c             	sub    $0xc,%esp
80100260:	50                   	push   %eax
80100261:	e8 c3 4c 00 00       	call   80104f29 <holdingsleep>
80100266:	83 c4 10             	add    $0x10,%esp
80100269:	85 c0                	test   %eax,%eax
8010026b:	75 0d                	jne    8010027a <brelse+0x29>
    panic("brelse");
8010026d:	83 ec 0c             	sub    $0xc,%esp
80100270:	68 ae 84 10 80       	push   $0x801084ae
80100275:	e8 3b 03 00 00       	call   801005b5 <panic>

  releasesleep(&b->lock);
8010027a:	8b 45 08             	mov    0x8(%ebp),%eax
8010027d:	83 c0 0c             	add    $0xc,%eax
80100280:	83 ec 0c             	sub    $0xc,%esp
80100283:	50                   	push   %eax
80100284:	e8 52 4c 00 00       	call   80104edb <releasesleep>
80100289:	83 c4 10             	add    $0x10,%esp

  acquire(&bcache.lock);
8010028c:	83 ec 0c             	sub    $0xc,%esp
8010028f:	68 80 b5 10 80       	push   $0x8010b580
80100294:	e8 21 4d 00 00       	call   80104fba <acquire>
80100299:	83 c4 10             	add    $0x10,%esp
  b->refcnt--;
8010029c:	8b 45 08             	mov    0x8(%ebp),%eax
8010029f:	8b 40 4c             	mov    0x4c(%eax),%eax
801002a2:	8d 50 ff             	lea    -0x1(%eax),%edx
801002a5:	8b 45 08             	mov    0x8(%ebp),%eax
801002a8:	89 50 4c             	mov    %edx,0x4c(%eax)
  if (b->refcnt == 0) {
801002ab:	8b 45 08             	mov    0x8(%ebp),%eax
801002ae:	8b 40 4c             	mov    0x4c(%eax),%eax
801002b1:	85 c0                	test   %eax,%eax
801002b3:	75 47                	jne    801002fc <brelse+0xab>
    // no one is waiting for it.
    b->next->prev = b->prev;
801002b5:	8b 45 08             	mov    0x8(%ebp),%eax
801002b8:	8b 40 54             	mov    0x54(%eax),%eax
801002bb:	8b 55 08             	mov    0x8(%ebp),%edx
801002be:	8b 52 50             	mov    0x50(%edx),%edx
801002c1:	89 50 50             	mov    %edx,0x50(%eax)
    b->prev->next = b->next;
801002c4:	8b 45 08             	mov    0x8(%ebp),%eax
801002c7:	8b 40 50             	mov    0x50(%eax),%eax
801002ca:	8b 55 08             	mov    0x8(%ebp),%edx
801002cd:	8b 52 54             	mov    0x54(%edx),%edx
801002d0:	89 50 54             	mov    %edx,0x54(%eax)
    b->next = bcache.head.next;
801002d3:	8b 15 d0 fc 10 80    	mov    0x8010fcd0,%edx
801002d9:	8b 45 08             	mov    0x8(%ebp),%eax
801002dc:	89 50 54             	mov    %edx,0x54(%eax)
    b->prev = &bcache.head;
801002df:	8b 45 08             	mov    0x8(%ebp),%eax
801002e2:	c7 40 50 7c fc 10 80 	movl   $0x8010fc7c,0x50(%eax)
    bcache.head.next->prev = b;
801002e9:	a1 d0 fc 10 80       	mov    0x8010fcd0,%eax
801002ee:	8b 55 08             	mov    0x8(%ebp),%edx
801002f1:	89 50 50             	mov    %edx,0x50(%eax)
    bcache.head.next = b;
801002f4:	8b 45 08             	mov    0x8(%ebp),%eax
801002f7:	a3 d0 fc 10 80       	mov    %eax,0x8010fcd0
  }
  
  release(&bcache.lock);
801002fc:	83 ec 0c             	sub    $0xc,%esp
801002ff:	68 80 b5 10 80       	push   $0x8010b580
80100304:	e8 1f 4d 00 00       	call   80105028 <release>
80100309:	83 c4 10             	add    $0x10,%esp
}
8010030c:	90                   	nop
8010030d:	c9                   	leave  
8010030e:	c3                   	ret    

8010030f <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
8010030f:	55                   	push   %ebp
80100310:	89 e5                	mov    %esp,%ebp
80100312:	83 ec 14             	sub    $0x14,%esp
80100315:	8b 45 08             	mov    0x8(%ebp),%eax
80100318:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010031c:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
80100320:	89 c2                	mov    %eax,%edx
80100322:	ec                   	in     (%dx),%al
80100323:	88 45 ff             	mov    %al,-0x1(%ebp)
  return data;
80100326:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
}
8010032a:	c9                   	leave  
8010032b:	c3                   	ret    

8010032c <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
8010032c:	55                   	push   %ebp
8010032d:	89 e5                	mov    %esp,%ebp
8010032f:	83 ec 08             	sub    $0x8,%esp
80100332:	8b 45 08             	mov    0x8(%ebp),%eax
80100335:	8b 55 0c             	mov    0xc(%ebp),%edx
80100338:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
8010033c:	89 d0                	mov    %edx,%eax
8010033e:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100341:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80100345:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80100349:	ee                   	out    %al,(%dx)
}
8010034a:	90                   	nop
8010034b:	c9                   	leave  
8010034c:	c3                   	ret    

8010034d <cli>:
  asm volatile("movw %0, %%gs" : : "r" (v));
}

static inline void
cli(void)
{
8010034d:	55                   	push   %ebp
8010034e:	89 e5                	mov    %esp,%ebp
  asm volatile("cli");
80100350:	fa                   	cli    
}
80100351:	90                   	nop
80100352:	5d                   	pop    %ebp
80100353:	c3                   	ret    

80100354 <printint>:
  int locking;
} cons;

static void
printint(int xx, int base, int sign)
{
80100354:	55                   	push   %ebp
80100355:	89 e5                	mov    %esp,%ebp
80100357:	83 ec 28             	sub    $0x28,%esp
  static char digits[] = "0123456789abcdef";
  char buf[16];
  int i;
  uint x;

  if(sign && (sign = xx < 0))
8010035a:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
8010035e:	74 1c                	je     8010037c <printint+0x28>
80100360:	8b 45 08             	mov    0x8(%ebp),%eax
80100363:	c1 e8 1f             	shr    $0x1f,%eax
80100366:	0f b6 c0             	movzbl %al,%eax
80100369:	89 45 10             	mov    %eax,0x10(%ebp)
8010036c:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100370:	74 0a                	je     8010037c <printint+0x28>
    x = -xx;
80100372:	8b 45 08             	mov    0x8(%ebp),%eax
80100375:	f7 d8                	neg    %eax
80100377:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010037a:	eb 06                	jmp    80100382 <printint+0x2e>
  else
    x = xx;
8010037c:	8b 45 08             	mov    0x8(%ebp),%eax
8010037f:	89 45 f0             	mov    %eax,-0x10(%ebp)

  i = 0;
80100382:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  do{
    buf[i++] = digits[x % base];
80100389:	8b 4d 0c             	mov    0xc(%ebp),%ecx
8010038c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010038f:	ba 00 00 00 00       	mov    $0x0,%edx
80100394:	f7 f1                	div    %ecx
80100396:	89 d1                	mov    %edx,%ecx
80100398:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010039b:	8d 50 01             	lea    0x1(%eax),%edx
8010039e:	89 55 f4             	mov    %edx,-0xc(%ebp)
801003a1:	0f b6 91 04 90 10 80 	movzbl -0x7fef6ffc(%ecx),%edx
801003a8:	88 54 05 e0          	mov    %dl,-0x20(%ebp,%eax,1)
  }while((x /= base) != 0);
801003ac:	8b 4d 0c             	mov    0xc(%ebp),%ecx
801003af:	8b 45 f0             	mov    -0x10(%ebp),%eax
801003b2:	ba 00 00 00 00       	mov    $0x0,%edx
801003b7:	f7 f1                	div    %ecx
801003b9:	89 45 f0             	mov    %eax,-0x10(%ebp)
801003bc:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801003c0:	75 c7                	jne    80100389 <printint+0x35>

  if(sign)
801003c2:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801003c6:	74 2a                	je     801003f2 <printint+0x9e>
    buf[i++] = '-';
801003c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801003cb:	8d 50 01             	lea    0x1(%eax),%edx
801003ce:	89 55 f4             	mov    %edx,-0xc(%ebp)
801003d1:	c6 44 05 e0 2d       	movb   $0x2d,-0x20(%ebp,%eax,1)

  while(--i >= 0)
801003d6:	eb 1a                	jmp    801003f2 <printint+0x9e>
    consputc(buf[i]);
801003d8:	8d 55 e0             	lea    -0x20(%ebp),%edx
801003db:	8b 45 f4             	mov    -0xc(%ebp),%eax
801003de:	01 d0                	add    %edx,%eax
801003e0:	0f b6 00             	movzbl (%eax),%eax
801003e3:	0f be c0             	movsbl %al,%eax
801003e6:	83 ec 0c             	sub    $0xc,%esp
801003e9:	50                   	push   %eax
801003ea:	e8 f9 03 00 00       	call   801007e8 <consputc>
801003ef:	83 c4 10             	add    $0x10,%esp
  while(--i >= 0)
801003f2:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
801003f6:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801003fa:	79 dc                	jns    801003d8 <printint+0x84>
}
801003fc:	90                   	nop
801003fd:	90                   	nop
801003fe:	c9                   	leave  
801003ff:	c3                   	ret    

80100400 <cprintf>:
//PAGEBREAK: 50

// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
80100400:	55                   	push   %ebp
80100401:	89 e5                	mov    %esp,%ebp
80100403:	83 ec 28             	sub    $0x28,%esp
  int i, c, locking;
  uint *argp;
  char *s;

  locking = cons.locking;
80100406:	a1 b4 ff 10 80       	mov    0x8010ffb4,%eax
8010040b:	89 45 e8             	mov    %eax,-0x18(%ebp)
  if(locking)
8010040e:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
80100412:	74 10                	je     80100424 <cprintf+0x24>
    acquire(&cons.lock);
80100414:	83 ec 0c             	sub    $0xc,%esp
80100417:	68 80 ff 10 80       	push   $0x8010ff80
8010041c:	e8 99 4b 00 00       	call   80104fba <acquire>
80100421:	83 c4 10             	add    $0x10,%esp

  if (fmt == 0)
80100424:	8b 45 08             	mov    0x8(%ebp),%eax
80100427:	85 c0                	test   %eax,%eax
80100429:	75 0d                	jne    80100438 <cprintf+0x38>
    panic("null fmt");
8010042b:	83 ec 0c             	sub    $0xc,%esp
8010042e:	68 b5 84 10 80       	push   $0x801084b5
80100433:	e8 7d 01 00 00       	call   801005b5 <panic>

  argp = (uint*)(void*)(&fmt + 1);
80100438:	8d 45 0c             	lea    0xc(%ebp),%eax
8010043b:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
8010043e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80100445:	e9 2f 01 00 00       	jmp    80100579 <cprintf+0x179>
    if(c != '%'){
8010044a:	83 7d e4 25          	cmpl   $0x25,-0x1c(%ebp)
8010044e:	74 13                	je     80100463 <cprintf+0x63>
      consputc(c);
80100450:	83 ec 0c             	sub    $0xc,%esp
80100453:	ff 75 e4             	push   -0x1c(%ebp)
80100456:	e8 8d 03 00 00       	call   801007e8 <consputc>
8010045b:	83 c4 10             	add    $0x10,%esp
      continue;
8010045e:	e9 12 01 00 00       	jmp    80100575 <cprintf+0x175>
    }
    c = fmt[++i] & 0xff;
80100463:	8b 55 08             	mov    0x8(%ebp),%edx
80100466:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010046a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010046d:	01 d0                	add    %edx,%eax
8010046f:	0f b6 00             	movzbl (%eax),%eax
80100472:	0f be c0             	movsbl %al,%eax
80100475:	25 ff 00 00 00       	and    $0xff,%eax
8010047a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    if(c == 0)
8010047d:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
80100481:	0f 84 14 01 00 00    	je     8010059b <cprintf+0x19b>
      break;
    switch(c){
80100487:	83 7d e4 78          	cmpl   $0x78,-0x1c(%ebp)
8010048b:	74 5e                	je     801004eb <cprintf+0xeb>
8010048d:	83 7d e4 78          	cmpl   $0x78,-0x1c(%ebp)
80100491:	0f 8f c2 00 00 00    	jg     80100559 <cprintf+0x159>
80100497:	83 7d e4 73          	cmpl   $0x73,-0x1c(%ebp)
8010049b:	74 6b                	je     80100508 <cprintf+0x108>
8010049d:	83 7d e4 73          	cmpl   $0x73,-0x1c(%ebp)
801004a1:	0f 8f b2 00 00 00    	jg     80100559 <cprintf+0x159>
801004a7:	83 7d e4 70          	cmpl   $0x70,-0x1c(%ebp)
801004ab:	74 3e                	je     801004eb <cprintf+0xeb>
801004ad:	83 7d e4 70          	cmpl   $0x70,-0x1c(%ebp)
801004b1:	0f 8f a2 00 00 00    	jg     80100559 <cprintf+0x159>
801004b7:	83 7d e4 25          	cmpl   $0x25,-0x1c(%ebp)
801004bb:	0f 84 89 00 00 00    	je     8010054a <cprintf+0x14a>
801004c1:	83 7d e4 64          	cmpl   $0x64,-0x1c(%ebp)
801004c5:	0f 85 8e 00 00 00    	jne    80100559 <cprintf+0x159>
    case 'd':
      printint(*argp++, 10, 1);
801004cb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801004ce:	8d 50 04             	lea    0x4(%eax),%edx
801004d1:	89 55 f0             	mov    %edx,-0x10(%ebp)
801004d4:	8b 00                	mov    (%eax),%eax
801004d6:	83 ec 04             	sub    $0x4,%esp
801004d9:	6a 01                	push   $0x1
801004db:	6a 0a                	push   $0xa
801004dd:	50                   	push   %eax
801004de:	e8 71 fe ff ff       	call   80100354 <printint>
801004e3:	83 c4 10             	add    $0x10,%esp
      break;
801004e6:	e9 8a 00 00 00       	jmp    80100575 <cprintf+0x175>
    case 'x':
    case 'p':
      printint(*argp++, 16, 0);
801004eb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801004ee:	8d 50 04             	lea    0x4(%eax),%edx
801004f1:	89 55 f0             	mov    %edx,-0x10(%ebp)
801004f4:	8b 00                	mov    (%eax),%eax
801004f6:	83 ec 04             	sub    $0x4,%esp
801004f9:	6a 00                	push   $0x0
801004fb:	6a 10                	push   $0x10
801004fd:	50                   	push   %eax
801004fe:	e8 51 fe ff ff       	call   80100354 <printint>
80100503:	83 c4 10             	add    $0x10,%esp
      break;
80100506:	eb 6d                	jmp    80100575 <cprintf+0x175>
    case 's':
      if((s = (char*)*argp++) == 0)
80100508:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010050b:	8d 50 04             	lea    0x4(%eax),%edx
8010050e:	89 55 f0             	mov    %edx,-0x10(%ebp)
80100511:	8b 00                	mov    (%eax),%eax
80100513:	89 45 ec             	mov    %eax,-0x14(%ebp)
80100516:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
8010051a:	75 22                	jne    8010053e <cprintf+0x13e>
        s = "(null)";
8010051c:	c7 45 ec be 84 10 80 	movl   $0x801084be,-0x14(%ebp)
      for(; *s; s++)
80100523:	eb 19                	jmp    8010053e <cprintf+0x13e>
        consputc(*s);
80100525:	8b 45 ec             	mov    -0x14(%ebp),%eax
80100528:	0f b6 00             	movzbl (%eax),%eax
8010052b:	0f be c0             	movsbl %al,%eax
8010052e:	83 ec 0c             	sub    $0xc,%esp
80100531:	50                   	push   %eax
80100532:	e8 b1 02 00 00       	call   801007e8 <consputc>
80100537:	83 c4 10             	add    $0x10,%esp
      for(; *s; s++)
8010053a:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
8010053e:	8b 45 ec             	mov    -0x14(%ebp),%eax
80100541:	0f b6 00             	movzbl (%eax),%eax
80100544:	84 c0                	test   %al,%al
80100546:	75 dd                	jne    80100525 <cprintf+0x125>
      break;
80100548:	eb 2b                	jmp    80100575 <cprintf+0x175>
    case '%':
      consputc('%');
8010054a:	83 ec 0c             	sub    $0xc,%esp
8010054d:	6a 25                	push   $0x25
8010054f:	e8 94 02 00 00       	call   801007e8 <consputc>
80100554:	83 c4 10             	add    $0x10,%esp
      break;
80100557:	eb 1c                	jmp    80100575 <cprintf+0x175>
    default:
      // Print unknown % sequence to draw attention.
      consputc('%');
80100559:	83 ec 0c             	sub    $0xc,%esp
8010055c:	6a 25                	push   $0x25
8010055e:	e8 85 02 00 00       	call   801007e8 <consputc>
80100563:	83 c4 10             	add    $0x10,%esp
      consputc(c);
80100566:	83 ec 0c             	sub    $0xc,%esp
80100569:	ff 75 e4             	push   -0x1c(%ebp)
8010056c:	e8 77 02 00 00       	call   801007e8 <consputc>
80100571:	83 c4 10             	add    $0x10,%esp
      break;
80100574:	90                   	nop
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100575:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100579:	8b 55 08             	mov    0x8(%ebp),%edx
8010057c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010057f:	01 d0                	add    %edx,%eax
80100581:	0f b6 00             	movzbl (%eax),%eax
80100584:	0f be c0             	movsbl %al,%eax
80100587:	25 ff 00 00 00       	and    $0xff,%eax
8010058c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
8010058f:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
80100593:	0f 85 b1 fe ff ff    	jne    8010044a <cprintf+0x4a>
80100599:	eb 01                	jmp    8010059c <cprintf+0x19c>
      break;
8010059b:	90                   	nop
    }
  }

  if(locking)
8010059c:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801005a0:	74 10                	je     801005b2 <cprintf+0x1b2>
    release(&cons.lock);
801005a2:	83 ec 0c             	sub    $0xc,%esp
801005a5:	68 80 ff 10 80       	push   $0x8010ff80
801005aa:	e8 79 4a 00 00       	call   80105028 <release>
801005af:	83 c4 10             	add    $0x10,%esp
}
801005b2:	90                   	nop
801005b3:	c9                   	leave  
801005b4:	c3                   	ret    

801005b5 <panic>:

void
panic(char *s)
{
801005b5:	55                   	push   %ebp
801005b6:	89 e5                	mov    %esp,%ebp
801005b8:	83 ec 38             	sub    $0x38,%esp
  int i;
  uint pcs[10];

  cli();
801005bb:	e8 8d fd ff ff       	call   8010034d <cli>
  cons.locking = 0;
801005c0:	c7 05 b4 ff 10 80 00 	movl   $0x0,0x8010ffb4
801005c7:	00 00 00 
  // use lapiccpunum so that we can call panic from mycpu()
  cprintf("lapicid %d: panic: ", lapicid());
801005ca:	e8 4e 2a 00 00       	call   8010301d <lapicid>
801005cf:	83 ec 08             	sub    $0x8,%esp
801005d2:	50                   	push   %eax
801005d3:	68 c5 84 10 80       	push   $0x801084c5
801005d8:	e8 23 fe ff ff       	call   80100400 <cprintf>
801005dd:	83 c4 10             	add    $0x10,%esp
  cprintf(s);
801005e0:	8b 45 08             	mov    0x8(%ebp),%eax
801005e3:	83 ec 0c             	sub    $0xc,%esp
801005e6:	50                   	push   %eax
801005e7:	e8 14 fe ff ff       	call   80100400 <cprintf>
801005ec:	83 c4 10             	add    $0x10,%esp
  cprintf("\n");
801005ef:	83 ec 0c             	sub    $0xc,%esp
801005f2:	68 d9 84 10 80       	push   $0x801084d9
801005f7:	e8 04 fe ff ff       	call   80100400 <cprintf>
801005fc:	83 c4 10             	add    $0x10,%esp
  getcallerpcs(&s, pcs);
801005ff:	83 ec 08             	sub    $0x8,%esp
80100602:	8d 45 cc             	lea    -0x34(%ebp),%eax
80100605:	50                   	push   %eax
80100606:	8d 45 08             	lea    0x8(%ebp),%eax
80100609:	50                   	push   %eax
8010060a:	e8 6b 4a 00 00       	call   8010507a <getcallerpcs>
8010060f:	83 c4 10             	add    $0x10,%esp
  for(i=0; i<10; i++)
80100612:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80100619:	eb 1c                	jmp    80100637 <panic+0x82>
    cprintf(" %p", pcs[i]);
8010061b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010061e:	8b 44 85 cc          	mov    -0x34(%ebp,%eax,4),%eax
80100622:	83 ec 08             	sub    $0x8,%esp
80100625:	50                   	push   %eax
80100626:	68 db 84 10 80       	push   $0x801084db
8010062b:	e8 d0 fd ff ff       	call   80100400 <cprintf>
80100630:	83 c4 10             	add    $0x10,%esp
  for(i=0; i<10; i++)
80100633:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100637:	83 7d f4 09          	cmpl   $0x9,-0xc(%ebp)
8010063b:	7e de                	jle    8010061b <panic+0x66>
  panicked = 1; // freeze other CPU
8010063d:	c7 05 6c ff 10 80 01 	movl   $0x1,0x8010ff6c
80100644:	00 00 00 
  for(;;)
80100647:	eb fe                	jmp    80100647 <panic+0x92>

80100649 <cgaputc>:
#define CRTPORT 0x3d4
static ushort *crt = (ushort*)P2V(0xb8000);  // CGA memory

static void
cgaputc(int c)
{
80100649:	55                   	push   %ebp
8010064a:	89 e5                	mov    %esp,%ebp
8010064c:	53                   	push   %ebx
8010064d:	83 ec 14             	sub    $0x14,%esp
  int pos;

  // Cursor position: col + 80*row.
  outb(CRTPORT, 14);
80100650:	6a 0e                	push   $0xe
80100652:	68 d4 03 00 00       	push   $0x3d4
80100657:	e8 d0 fc ff ff       	call   8010032c <outb>
8010065c:	83 c4 08             	add    $0x8,%esp
  pos = inb(CRTPORT+1) << 8;
8010065f:	68 d5 03 00 00       	push   $0x3d5
80100664:	e8 a6 fc ff ff       	call   8010030f <inb>
80100669:	83 c4 04             	add    $0x4,%esp
8010066c:	0f b6 c0             	movzbl %al,%eax
8010066f:	c1 e0 08             	shl    $0x8,%eax
80100672:	89 45 f4             	mov    %eax,-0xc(%ebp)
  outb(CRTPORT, 15);
80100675:	6a 0f                	push   $0xf
80100677:	68 d4 03 00 00       	push   $0x3d4
8010067c:	e8 ab fc ff ff       	call   8010032c <outb>
80100681:	83 c4 08             	add    $0x8,%esp
  pos |= inb(CRTPORT+1);
80100684:	68 d5 03 00 00       	push   $0x3d5
80100689:	e8 81 fc ff ff       	call   8010030f <inb>
8010068e:	83 c4 04             	add    $0x4,%esp
80100691:	0f b6 c0             	movzbl %al,%eax
80100694:	09 45 f4             	or     %eax,-0xc(%ebp)

  if(c == '\n')
80100697:	83 7d 08 0a          	cmpl   $0xa,0x8(%ebp)
8010069b:	75 34                	jne    801006d1 <cgaputc+0x88>
    pos += 80 - pos%80;
8010069d:	8b 4d f4             	mov    -0xc(%ebp),%ecx
801006a0:	ba 67 66 66 66       	mov    $0x66666667,%edx
801006a5:	89 c8                	mov    %ecx,%eax
801006a7:	f7 ea                	imul   %edx
801006a9:	89 d0                	mov    %edx,%eax
801006ab:	c1 f8 05             	sar    $0x5,%eax
801006ae:	89 cb                	mov    %ecx,%ebx
801006b0:	c1 fb 1f             	sar    $0x1f,%ebx
801006b3:	29 d8                	sub    %ebx,%eax
801006b5:	89 c2                	mov    %eax,%edx
801006b7:	89 d0                	mov    %edx,%eax
801006b9:	c1 e0 02             	shl    $0x2,%eax
801006bc:	01 d0                	add    %edx,%eax
801006be:	c1 e0 04             	shl    $0x4,%eax
801006c1:	29 c1                	sub    %eax,%ecx
801006c3:	89 ca                	mov    %ecx,%edx
801006c5:	b8 50 00 00 00       	mov    $0x50,%eax
801006ca:	29 d0                	sub    %edx,%eax
801006cc:	01 45 f4             	add    %eax,-0xc(%ebp)
801006cf:	eb 38                	jmp    80100709 <cgaputc+0xc0>
  else if(c == BACKSPACE){
801006d1:	81 7d 08 00 01 00 00 	cmpl   $0x100,0x8(%ebp)
801006d8:	75 0c                	jne    801006e6 <cgaputc+0x9d>
    if(pos > 0) --pos;
801006da:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801006de:	7e 29                	jle    80100709 <cgaputc+0xc0>
801006e0:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
801006e4:	eb 23                	jmp    80100709 <cgaputc+0xc0>
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
801006e6:	8b 45 08             	mov    0x8(%ebp),%eax
801006e9:	0f b6 c0             	movzbl %al,%eax
801006ec:	80 cc 07             	or     $0x7,%ah
801006ef:	89 c1                	mov    %eax,%ecx
801006f1:	8b 1d 00 90 10 80    	mov    0x80109000,%ebx
801006f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801006fa:	8d 50 01             	lea    0x1(%eax),%edx
801006fd:	89 55 f4             	mov    %edx,-0xc(%ebp)
80100700:	01 c0                	add    %eax,%eax
80100702:	01 d8                	add    %ebx,%eax
80100704:	89 ca                	mov    %ecx,%edx
80100706:	66 89 10             	mov    %dx,(%eax)

  if(pos < 0 || pos > 25*80)
80100709:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010070d:	78 09                	js     80100718 <cgaputc+0xcf>
8010070f:	81 7d f4 d0 07 00 00 	cmpl   $0x7d0,-0xc(%ebp)
80100716:	7e 0d                	jle    80100725 <cgaputc+0xdc>
    panic("pos under/overflow");
80100718:	83 ec 0c             	sub    $0xc,%esp
8010071b:	68 df 84 10 80       	push   $0x801084df
80100720:	e8 90 fe ff ff       	call   801005b5 <panic>

  if((pos/80) >= 24){  // Scroll up.
80100725:	81 7d f4 7f 07 00 00 	cmpl   $0x77f,-0xc(%ebp)
8010072c:	7e 4d                	jle    8010077b <cgaputc+0x132>
    memmove(crt, crt+80, sizeof(crt[0])*23*80);
8010072e:	a1 00 90 10 80       	mov    0x80109000,%eax
80100733:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
80100739:	a1 00 90 10 80       	mov    0x80109000,%eax
8010073e:	83 ec 04             	sub    $0x4,%esp
80100741:	68 60 0e 00 00       	push   $0xe60
80100746:	52                   	push   %edx
80100747:	50                   	push   %eax
80100748:	e8 a2 4b 00 00       	call   801052ef <memmove>
8010074d:	83 c4 10             	add    $0x10,%esp
    pos -= 80;
80100750:	83 6d f4 50          	subl   $0x50,-0xc(%ebp)
    memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
80100754:	b8 80 07 00 00       	mov    $0x780,%eax
80100759:	2b 45 f4             	sub    -0xc(%ebp),%eax
8010075c:	8d 14 00             	lea    (%eax,%eax,1),%edx
8010075f:	8b 0d 00 90 10 80    	mov    0x80109000,%ecx
80100765:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100768:	01 c0                	add    %eax,%eax
8010076a:	01 c8                	add    %ecx,%eax
8010076c:	83 ec 04             	sub    $0x4,%esp
8010076f:	52                   	push   %edx
80100770:	6a 00                	push   $0x0
80100772:	50                   	push   %eax
80100773:	e8 b8 4a 00 00       	call   80105230 <memset>
80100778:	83 c4 10             	add    $0x10,%esp
  }

  outb(CRTPORT, 14);
8010077b:	83 ec 08             	sub    $0x8,%esp
8010077e:	6a 0e                	push   $0xe
80100780:	68 d4 03 00 00       	push   $0x3d4
80100785:	e8 a2 fb ff ff       	call   8010032c <outb>
8010078a:	83 c4 10             	add    $0x10,%esp
  outb(CRTPORT+1, pos>>8);
8010078d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100790:	c1 f8 08             	sar    $0x8,%eax
80100793:	0f b6 c0             	movzbl %al,%eax
80100796:	83 ec 08             	sub    $0x8,%esp
80100799:	50                   	push   %eax
8010079a:	68 d5 03 00 00       	push   $0x3d5
8010079f:	e8 88 fb ff ff       	call   8010032c <outb>
801007a4:	83 c4 10             	add    $0x10,%esp
  outb(CRTPORT, 15);
801007a7:	83 ec 08             	sub    $0x8,%esp
801007aa:	6a 0f                	push   $0xf
801007ac:	68 d4 03 00 00       	push   $0x3d4
801007b1:	e8 76 fb ff ff       	call   8010032c <outb>
801007b6:	83 c4 10             	add    $0x10,%esp
  outb(CRTPORT+1, pos);
801007b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801007bc:	0f b6 c0             	movzbl %al,%eax
801007bf:	83 ec 08             	sub    $0x8,%esp
801007c2:	50                   	push   %eax
801007c3:	68 d5 03 00 00       	push   $0x3d5
801007c8:	e8 5f fb ff ff       	call   8010032c <outb>
801007cd:	83 c4 10             	add    $0x10,%esp
  crt[pos] = ' ' | 0x0700;
801007d0:	8b 15 00 90 10 80    	mov    0x80109000,%edx
801007d6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801007d9:	01 c0                	add    %eax,%eax
801007db:	01 d0                	add    %edx,%eax
801007dd:	66 c7 00 20 07       	movw   $0x720,(%eax)
}
801007e2:	90                   	nop
801007e3:	8b 5d fc             	mov    -0x4(%ebp),%ebx
801007e6:	c9                   	leave  
801007e7:	c3                   	ret    

801007e8 <consputc>:

void
consputc(int c)
{
801007e8:	55                   	push   %ebp
801007e9:	89 e5                	mov    %esp,%ebp
801007eb:	83 ec 08             	sub    $0x8,%esp
  if(panicked){
801007ee:	a1 6c ff 10 80       	mov    0x8010ff6c,%eax
801007f3:	85 c0                	test   %eax,%eax
801007f5:	74 07                	je     801007fe <consputc+0x16>
    cli();
801007f7:	e8 51 fb ff ff       	call   8010034d <cli>
    for(;;)
801007fc:	eb fe                	jmp    801007fc <consputc+0x14>
      ;
  }

  if(c == BACKSPACE){
801007fe:	81 7d 08 00 01 00 00 	cmpl   $0x100,0x8(%ebp)
80100805:	75 29                	jne    80100830 <consputc+0x48>
    uartputc('\b'); uartputc(' '); uartputc('\b');
80100807:	83 ec 0c             	sub    $0xc,%esp
8010080a:	6a 08                	push   $0x8
8010080c:	e8 82 63 00 00       	call   80106b93 <uartputc>
80100811:	83 c4 10             	add    $0x10,%esp
80100814:	83 ec 0c             	sub    $0xc,%esp
80100817:	6a 20                	push   $0x20
80100819:	e8 75 63 00 00       	call   80106b93 <uartputc>
8010081e:	83 c4 10             	add    $0x10,%esp
80100821:	83 ec 0c             	sub    $0xc,%esp
80100824:	6a 08                	push   $0x8
80100826:	e8 68 63 00 00       	call   80106b93 <uartputc>
8010082b:	83 c4 10             	add    $0x10,%esp
8010082e:	eb 0e                	jmp    8010083e <consputc+0x56>
  } else
    uartputc(c);
80100830:	83 ec 0c             	sub    $0xc,%esp
80100833:	ff 75 08             	push   0x8(%ebp)
80100836:	e8 58 63 00 00       	call   80106b93 <uartputc>
8010083b:	83 c4 10             	add    $0x10,%esp
  cgaputc(c);
8010083e:	83 ec 0c             	sub    $0xc,%esp
80100841:	ff 75 08             	push   0x8(%ebp)
80100844:	e8 00 fe ff ff       	call   80100649 <cgaputc>
80100849:	83 c4 10             	add    $0x10,%esp
}
8010084c:	90                   	nop
8010084d:	c9                   	leave  
8010084e:	c3                   	ret    

8010084f <consoleintr>:

#define C(x)  ((x)-'@')  // Control-x

void
consoleintr(int (*getc)(void))
{
8010084f:	55                   	push   %ebp
80100850:	89 e5                	mov    %esp,%ebp
80100852:	83 ec 18             	sub    $0x18,%esp
  int c, doprocdump = 0;
80100855:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

  acquire(&cons.lock);
8010085c:	83 ec 0c             	sub    $0xc,%esp
8010085f:	68 80 ff 10 80       	push   $0x8010ff80
80100864:	e8 51 47 00 00       	call   80104fba <acquire>
80100869:	83 c4 10             	add    $0x10,%esp
  while((c = getc()) >= 0){
8010086c:	e9 50 01 00 00       	jmp    801009c1 <consoleintr+0x172>
    switch(c){
80100871:	83 7d f0 7f          	cmpl   $0x7f,-0x10(%ebp)
80100875:	0f 84 81 00 00 00    	je     801008fc <consoleintr+0xad>
8010087b:	83 7d f0 7f          	cmpl   $0x7f,-0x10(%ebp)
8010087f:	0f 8f ac 00 00 00    	jg     80100931 <consoleintr+0xe2>
80100885:	83 7d f0 15          	cmpl   $0x15,-0x10(%ebp)
80100889:	74 43                	je     801008ce <consoleintr+0x7f>
8010088b:	83 7d f0 15          	cmpl   $0x15,-0x10(%ebp)
8010088f:	0f 8f 9c 00 00 00    	jg     80100931 <consoleintr+0xe2>
80100895:	83 7d f0 08          	cmpl   $0x8,-0x10(%ebp)
80100899:	74 61                	je     801008fc <consoleintr+0xad>
8010089b:	83 7d f0 10          	cmpl   $0x10,-0x10(%ebp)
8010089f:	0f 85 8c 00 00 00    	jne    80100931 <consoleintr+0xe2>
    case C('P'):  // Process listing.
      // procdump() locks cons.lock indirectly; invoke later
      doprocdump = 1;
801008a5:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
      break;
801008ac:	e9 10 01 00 00       	jmp    801009c1 <consoleintr+0x172>
    case C('U'):  // Kill line.
      while(input.e != input.w &&
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
801008b1:	a1 68 ff 10 80       	mov    0x8010ff68,%eax
801008b6:	83 e8 01             	sub    $0x1,%eax
801008b9:	a3 68 ff 10 80       	mov    %eax,0x8010ff68
        consputc(BACKSPACE);
801008be:	83 ec 0c             	sub    $0xc,%esp
801008c1:	68 00 01 00 00       	push   $0x100
801008c6:	e8 1d ff ff ff       	call   801007e8 <consputc>
801008cb:	83 c4 10             	add    $0x10,%esp
      while(input.e != input.w &&
801008ce:	8b 15 68 ff 10 80    	mov    0x8010ff68,%edx
801008d4:	a1 64 ff 10 80       	mov    0x8010ff64,%eax
801008d9:	39 c2                	cmp    %eax,%edx
801008db:	0f 84 e0 00 00 00    	je     801009c1 <consoleintr+0x172>
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
801008e1:	a1 68 ff 10 80       	mov    0x8010ff68,%eax
801008e6:	83 e8 01             	sub    $0x1,%eax
801008e9:	83 e0 7f             	and    $0x7f,%eax
801008ec:	0f b6 80 e0 fe 10 80 	movzbl -0x7fef0120(%eax),%eax
      while(input.e != input.w &&
801008f3:	3c 0a                	cmp    $0xa,%al
801008f5:	75 ba                	jne    801008b1 <consoleintr+0x62>
      }
      break;
801008f7:	e9 c5 00 00 00       	jmp    801009c1 <consoleintr+0x172>
    case C('H'): case '\x7f':  // Backspace
      if(input.e != input.w){
801008fc:	8b 15 68 ff 10 80    	mov    0x8010ff68,%edx
80100902:	a1 64 ff 10 80       	mov    0x8010ff64,%eax
80100907:	39 c2                	cmp    %eax,%edx
80100909:	0f 84 b2 00 00 00    	je     801009c1 <consoleintr+0x172>
        input.e--;
8010090f:	a1 68 ff 10 80       	mov    0x8010ff68,%eax
80100914:	83 e8 01             	sub    $0x1,%eax
80100917:	a3 68 ff 10 80       	mov    %eax,0x8010ff68
        consputc(BACKSPACE);
8010091c:	83 ec 0c             	sub    $0xc,%esp
8010091f:	68 00 01 00 00       	push   $0x100
80100924:	e8 bf fe ff ff       	call   801007e8 <consputc>
80100929:	83 c4 10             	add    $0x10,%esp
      }
      break;
8010092c:	e9 90 00 00 00       	jmp    801009c1 <consoleintr+0x172>
    default:
      if(c != 0 && input.e-input.r < INPUT_BUF){
80100931:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80100935:	0f 84 85 00 00 00    	je     801009c0 <consoleintr+0x171>
8010093b:	a1 68 ff 10 80       	mov    0x8010ff68,%eax
80100940:	8b 15 60 ff 10 80    	mov    0x8010ff60,%edx
80100946:	29 d0                	sub    %edx,%eax
80100948:	83 f8 7f             	cmp    $0x7f,%eax
8010094b:	77 73                	ja     801009c0 <consoleintr+0x171>
        c = (c == '\r') ? '\n' : c;
8010094d:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
80100951:	74 05                	je     80100958 <consoleintr+0x109>
80100953:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100956:	eb 05                	jmp    8010095d <consoleintr+0x10e>
80100958:	b8 0a 00 00 00       	mov    $0xa,%eax
8010095d:	89 45 f0             	mov    %eax,-0x10(%ebp)
        input.buf[input.e++ % INPUT_BUF] = c;
80100960:	a1 68 ff 10 80       	mov    0x8010ff68,%eax
80100965:	8d 50 01             	lea    0x1(%eax),%edx
80100968:	89 15 68 ff 10 80    	mov    %edx,0x8010ff68
8010096e:	83 e0 7f             	and    $0x7f,%eax
80100971:	8b 55 f0             	mov    -0x10(%ebp),%edx
80100974:	88 90 e0 fe 10 80    	mov    %dl,-0x7fef0120(%eax)
        consputc(c);
8010097a:	83 ec 0c             	sub    $0xc,%esp
8010097d:	ff 75 f0             	push   -0x10(%ebp)
80100980:	e8 63 fe ff ff       	call   801007e8 <consputc>
80100985:	83 c4 10             	add    $0x10,%esp
        if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
80100988:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
8010098c:	74 18                	je     801009a6 <consoleintr+0x157>
8010098e:	83 7d f0 04          	cmpl   $0x4,-0x10(%ebp)
80100992:	74 12                	je     801009a6 <consoleintr+0x157>
80100994:	a1 68 ff 10 80       	mov    0x8010ff68,%eax
80100999:	8b 15 60 ff 10 80    	mov    0x8010ff60,%edx
8010099f:	83 ea 80             	sub    $0xffffff80,%edx
801009a2:	39 d0                	cmp    %edx,%eax
801009a4:	75 1a                	jne    801009c0 <consoleintr+0x171>
          input.w = input.e;
801009a6:	a1 68 ff 10 80       	mov    0x8010ff68,%eax
801009ab:	a3 64 ff 10 80       	mov    %eax,0x8010ff64
          wakeup(&input.r);
801009b0:	83 ec 0c             	sub    $0xc,%esp
801009b3:	68 60 ff 10 80       	push   $0x8010ff60
801009b8:	e8 c9 42 00 00       	call   80104c86 <wakeup>
801009bd:	83 c4 10             	add    $0x10,%esp
        }
      }
      break;
801009c0:	90                   	nop
  while((c = getc()) >= 0){
801009c1:	8b 45 08             	mov    0x8(%ebp),%eax
801009c4:	ff d0                	call   *%eax
801009c6:	89 45 f0             	mov    %eax,-0x10(%ebp)
801009c9:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801009cd:	0f 89 9e fe ff ff    	jns    80100871 <consoleintr+0x22>
    }
  }
  release(&cons.lock);
801009d3:	83 ec 0c             	sub    $0xc,%esp
801009d6:	68 80 ff 10 80       	push   $0x8010ff80
801009db:	e8 48 46 00 00       	call   80105028 <release>
801009e0:	83 c4 10             	add    $0x10,%esp
  if(doprocdump) {
801009e3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801009e7:	74 05                	je     801009ee <consoleintr+0x19f>
    procdump();  // now call procdump() wo. cons.lock held
801009e9:	e8 53 43 00 00       	call   80104d41 <procdump>
  }
}
801009ee:	90                   	nop
801009ef:	c9                   	leave  
801009f0:	c3                   	ret    

801009f1 <consoleread>:

int
consoleread(struct inode *ip, char *dst, int n)
{
801009f1:	55                   	push   %ebp
801009f2:	89 e5                	mov    %esp,%ebp
801009f4:	83 ec 18             	sub    $0x18,%esp
  uint target;
  int c;

  iunlock(ip);
801009f7:	83 ec 0c             	sub    $0xc,%esp
801009fa:	ff 75 08             	push   0x8(%ebp)
801009fd:	e8 3e 11 00 00       	call   80101b40 <iunlock>
80100a02:	83 c4 10             	add    $0x10,%esp
  target = n;
80100a05:	8b 45 10             	mov    0x10(%ebp),%eax
80100a08:	89 45 f4             	mov    %eax,-0xc(%ebp)
  acquire(&cons.lock);
80100a0b:	83 ec 0c             	sub    $0xc,%esp
80100a0e:	68 80 ff 10 80       	push   $0x8010ff80
80100a13:	e8 a2 45 00 00       	call   80104fba <acquire>
80100a18:	83 c4 10             	add    $0x10,%esp
  while(n > 0){
80100a1b:	e9 ab 00 00 00       	jmp    80100acb <consoleread+0xda>
    while(input.r == input.w){
      if(myproc()->killed){
80100a20:	e8 b7 38 00 00       	call   801042dc <myproc>
80100a25:	8b 40 24             	mov    0x24(%eax),%eax
80100a28:	85 c0                	test   %eax,%eax
80100a2a:	74 28                	je     80100a54 <consoleread+0x63>
        release(&cons.lock);
80100a2c:	83 ec 0c             	sub    $0xc,%esp
80100a2f:	68 80 ff 10 80       	push   $0x8010ff80
80100a34:	e8 ef 45 00 00       	call   80105028 <release>
80100a39:	83 c4 10             	add    $0x10,%esp
        ilock(ip);
80100a3c:	83 ec 0c             	sub    $0xc,%esp
80100a3f:	ff 75 08             	push   0x8(%ebp)
80100a42:	e8 e6 0f 00 00       	call   80101a2d <ilock>
80100a47:	83 c4 10             	add    $0x10,%esp
        return -1;
80100a4a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80100a4f:	e9 a9 00 00 00       	jmp    80100afd <consoleread+0x10c>
      }
      sleep(&input.r, &cons.lock);
80100a54:	83 ec 08             	sub    $0x8,%esp
80100a57:	68 80 ff 10 80       	push   $0x8010ff80
80100a5c:	68 60 ff 10 80       	push   $0x8010ff60
80100a61:	e8 39 41 00 00       	call   80104b9f <sleep>
80100a66:	83 c4 10             	add    $0x10,%esp
    while(input.r == input.w){
80100a69:	8b 15 60 ff 10 80    	mov    0x8010ff60,%edx
80100a6f:	a1 64 ff 10 80       	mov    0x8010ff64,%eax
80100a74:	39 c2                	cmp    %eax,%edx
80100a76:	74 a8                	je     80100a20 <consoleread+0x2f>
    }
    c = input.buf[input.r++ % INPUT_BUF];
80100a78:	a1 60 ff 10 80       	mov    0x8010ff60,%eax
80100a7d:	8d 50 01             	lea    0x1(%eax),%edx
80100a80:	89 15 60 ff 10 80    	mov    %edx,0x8010ff60
80100a86:	83 e0 7f             	and    $0x7f,%eax
80100a89:	0f b6 80 e0 fe 10 80 	movzbl -0x7fef0120(%eax),%eax
80100a90:	0f be c0             	movsbl %al,%eax
80100a93:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(c == C('D')){  // EOF
80100a96:	83 7d f0 04          	cmpl   $0x4,-0x10(%ebp)
80100a9a:	75 17                	jne    80100ab3 <consoleread+0xc2>
      if(n < target){
80100a9c:	8b 45 10             	mov    0x10(%ebp),%eax
80100a9f:	39 45 f4             	cmp    %eax,-0xc(%ebp)
80100aa2:	76 2f                	jbe    80100ad3 <consoleread+0xe2>
        // Save ^D for next time, to make sure
        // caller gets a 0-byte result.
        input.r--;
80100aa4:	a1 60 ff 10 80       	mov    0x8010ff60,%eax
80100aa9:	83 e8 01             	sub    $0x1,%eax
80100aac:	a3 60 ff 10 80       	mov    %eax,0x8010ff60
      }
      break;
80100ab1:	eb 20                	jmp    80100ad3 <consoleread+0xe2>
    }
    *dst++ = c;
80100ab3:	8b 45 0c             	mov    0xc(%ebp),%eax
80100ab6:	8d 50 01             	lea    0x1(%eax),%edx
80100ab9:	89 55 0c             	mov    %edx,0xc(%ebp)
80100abc:	8b 55 f0             	mov    -0x10(%ebp),%edx
80100abf:	88 10                	mov    %dl,(%eax)
    --n;
80100ac1:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
    if(c == '\n')
80100ac5:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
80100ac9:	74 0b                	je     80100ad6 <consoleread+0xe5>
  while(n > 0){
80100acb:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100acf:	7f 98                	jg     80100a69 <consoleread+0x78>
80100ad1:	eb 04                	jmp    80100ad7 <consoleread+0xe6>
      break;
80100ad3:	90                   	nop
80100ad4:	eb 01                	jmp    80100ad7 <consoleread+0xe6>
      break;
80100ad6:	90                   	nop
  }
  release(&cons.lock);
80100ad7:	83 ec 0c             	sub    $0xc,%esp
80100ada:	68 80 ff 10 80       	push   $0x8010ff80
80100adf:	e8 44 45 00 00       	call   80105028 <release>
80100ae4:	83 c4 10             	add    $0x10,%esp
  ilock(ip);
80100ae7:	83 ec 0c             	sub    $0xc,%esp
80100aea:	ff 75 08             	push   0x8(%ebp)
80100aed:	e8 3b 0f 00 00       	call   80101a2d <ilock>
80100af2:	83 c4 10             	add    $0x10,%esp

  return target - n;
80100af5:	8b 55 10             	mov    0x10(%ebp),%edx
80100af8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100afb:	29 d0                	sub    %edx,%eax
}
80100afd:	c9                   	leave  
80100afe:	c3                   	ret    

80100aff <consolewrite>:

int
consolewrite(struct inode *ip, char *buf, int n)
{
80100aff:	55                   	push   %ebp
80100b00:	89 e5                	mov    %esp,%ebp
80100b02:	83 ec 18             	sub    $0x18,%esp
  int i;

  iunlock(ip);
80100b05:	83 ec 0c             	sub    $0xc,%esp
80100b08:	ff 75 08             	push   0x8(%ebp)
80100b0b:	e8 30 10 00 00       	call   80101b40 <iunlock>
80100b10:	83 c4 10             	add    $0x10,%esp
  acquire(&cons.lock);
80100b13:	83 ec 0c             	sub    $0xc,%esp
80100b16:	68 80 ff 10 80       	push   $0x8010ff80
80100b1b:	e8 9a 44 00 00       	call   80104fba <acquire>
80100b20:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i < n; i++)
80100b23:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80100b2a:	eb 21                	jmp    80100b4d <consolewrite+0x4e>
    consputc(buf[i] & 0xff);
80100b2c:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100b2f:	8b 45 0c             	mov    0xc(%ebp),%eax
80100b32:	01 d0                	add    %edx,%eax
80100b34:	0f b6 00             	movzbl (%eax),%eax
80100b37:	0f be c0             	movsbl %al,%eax
80100b3a:	0f b6 c0             	movzbl %al,%eax
80100b3d:	83 ec 0c             	sub    $0xc,%esp
80100b40:	50                   	push   %eax
80100b41:	e8 a2 fc ff ff       	call   801007e8 <consputc>
80100b46:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i < n; i++)
80100b49:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100b4d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100b50:	3b 45 10             	cmp    0x10(%ebp),%eax
80100b53:	7c d7                	jl     80100b2c <consolewrite+0x2d>
  release(&cons.lock);
80100b55:	83 ec 0c             	sub    $0xc,%esp
80100b58:	68 80 ff 10 80       	push   $0x8010ff80
80100b5d:	e8 c6 44 00 00       	call   80105028 <release>
80100b62:	83 c4 10             	add    $0x10,%esp
  ilock(ip);
80100b65:	83 ec 0c             	sub    $0xc,%esp
80100b68:	ff 75 08             	push   0x8(%ebp)
80100b6b:	e8 bd 0e 00 00       	call   80101a2d <ilock>
80100b70:	83 c4 10             	add    $0x10,%esp

  return n;
80100b73:	8b 45 10             	mov    0x10(%ebp),%eax
}
80100b76:	c9                   	leave  
80100b77:	c3                   	ret    

80100b78 <consoleinit>:

void
consoleinit(void)
{
80100b78:	55                   	push   %ebp
80100b79:	89 e5                	mov    %esp,%ebp
80100b7b:	83 ec 08             	sub    $0x8,%esp
  initlock(&cons.lock, "console");
80100b7e:	83 ec 08             	sub    $0x8,%esp
80100b81:	68 f2 84 10 80       	push   $0x801084f2
80100b86:	68 80 ff 10 80       	push   $0x8010ff80
80100b8b:	e8 08 44 00 00       	call   80104f98 <initlock>
80100b90:	83 c4 10             	add    $0x10,%esp

  devsw[CONSOLE].write = consolewrite;
80100b93:	c7 05 cc ff 10 80 ff 	movl   $0x80100aff,0x8010ffcc
80100b9a:	0a 10 80 
  devsw[CONSOLE].read = consoleread;
80100b9d:	c7 05 c8 ff 10 80 f1 	movl   $0x801009f1,0x8010ffc8
80100ba4:	09 10 80 
  cons.locking = 1;
80100ba7:	c7 05 b4 ff 10 80 01 	movl   $0x1,0x8010ffb4
80100bae:	00 00 00 

  ioapicenable(IRQ_KBD, 0);
80100bb1:	83 ec 08             	sub    $0x8,%esp
80100bb4:	6a 00                	push   $0x0
80100bb6:	6a 01                	push   $0x1
80100bb8:	e8 7a 1f 00 00       	call   80102b37 <ioapicenable>
80100bbd:	83 c4 10             	add    $0x10,%esp
}
80100bc0:	90                   	nop
80100bc1:	c9                   	leave  
80100bc2:	c3                   	ret    

80100bc3 <exec>:
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
{
80100bc3:	55                   	push   %ebp
80100bc4:	89 e5                	mov    %esp,%ebp
80100bc6:	81 ec 18 01 00 00    	sub    $0x118,%esp
  uint argc, sz, sp, ustack[3+MAXARG+1];
  struct elfhdr elf;
  struct inode *ip;
  struct proghdr ph;
  pde_t *pgdir, *oldpgdir;
  struct proc *curproc = myproc();
80100bcc:	e8 0b 37 00 00       	call   801042dc <myproc>
80100bd1:	89 45 d0             	mov    %eax,-0x30(%ebp)

  begin_op();
80100bd4:	e8 86 29 00 00       	call   8010355f <begin_op>

  if((ip = namei(path)) == 0){
80100bd9:	83 ec 0c             	sub    $0xc,%esp
80100bdc:	ff 75 08             	push   0x8(%ebp)
80100bdf:	e8 7c 19 00 00       	call   80102560 <namei>
80100be4:	83 c4 10             	add    $0x10,%esp
80100be7:	89 45 d8             	mov    %eax,-0x28(%ebp)
80100bea:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
80100bee:	75 1f                	jne    80100c0f <exec+0x4c>
    end_op();
80100bf0:	e8 f6 29 00 00       	call   801035eb <end_op>
    cprintf("exec: fail\n");
80100bf5:	83 ec 0c             	sub    $0xc,%esp
80100bf8:	68 fa 84 10 80       	push   $0x801084fa
80100bfd:	e8 fe f7 ff ff       	call   80100400 <cprintf>
80100c02:	83 c4 10             	add    $0x10,%esp
    return -1;
80100c05:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80100c0a:	e9 f1 03 00 00       	jmp    80101000 <exec+0x43d>
  }
  ilock(ip);
80100c0f:	83 ec 0c             	sub    $0xc,%esp
80100c12:	ff 75 d8             	push   -0x28(%ebp)
80100c15:	e8 13 0e 00 00       	call   80101a2d <ilock>
80100c1a:	83 c4 10             	add    $0x10,%esp
  pgdir = 0;
80100c1d:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)

  // Check ELF header
  if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
80100c24:	6a 34                	push   $0x34
80100c26:	6a 00                	push   $0x0
80100c28:	8d 85 08 ff ff ff    	lea    -0xf8(%ebp),%eax
80100c2e:	50                   	push   %eax
80100c2f:	ff 75 d8             	push   -0x28(%ebp)
80100c32:	e8 e2 12 00 00       	call   80101f19 <readi>
80100c37:	83 c4 10             	add    $0x10,%esp
80100c3a:	83 f8 34             	cmp    $0x34,%eax
80100c3d:	0f 85 66 03 00 00    	jne    80100fa9 <exec+0x3e6>
    goto bad;
  if(elf.magic != ELF_MAGIC)
80100c43:	8b 85 08 ff ff ff    	mov    -0xf8(%ebp),%eax
80100c49:	3d 7f 45 4c 46       	cmp    $0x464c457f,%eax
80100c4e:	0f 85 58 03 00 00    	jne    80100fac <exec+0x3e9>
    goto bad;

  if((pgdir = setupkvm()) == 0)
80100c54:	e8 47 6f 00 00       	call   80107ba0 <setupkvm>
80100c59:	89 45 d4             	mov    %eax,-0x2c(%ebp)
80100c5c:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
80100c60:	0f 84 49 03 00 00    	je     80100faf <exec+0x3ec>
    goto bad;

  // Load program into memory.
  sz = 0;
80100c66:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100c6d:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
80100c74:	8b 85 24 ff ff ff    	mov    -0xdc(%ebp),%eax
80100c7a:	89 45 e8             	mov    %eax,-0x18(%ebp)
80100c7d:	e9 de 00 00 00       	jmp    80100d60 <exec+0x19d>
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100c82:	8b 45 e8             	mov    -0x18(%ebp),%eax
80100c85:	6a 20                	push   $0x20
80100c87:	50                   	push   %eax
80100c88:	8d 85 e8 fe ff ff    	lea    -0x118(%ebp),%eax
80100c8e:	50                   	push   %eax
80100c8f:	ff 75 d8             	push   -0x28(%ebp)
80100c92:	e8 82 12 00 00       	call   80101f19 <readi>
80100c97:	83 c4 10             	add    $0x10,%esp
80100c9a:	83 f8 20             	cmp    $0x20,%eax
80100c9d:	0f 85 0f 03 00 00    	jne    80100fb2 <exec+0x3ef>
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
80100ca3:	8b 85 e8 fe ff ff    	mov    -0x118(%ebp),%eax
80100ca9:	83 f8 01             	cmp    $0x1,%eax
80100cac:	0f 85 a0 00 00 00    	jne    80100d52 <exec+0x18f>
      continue;
    if(ph.memsz < ph.filesz)
80100cb2:	8b 95 fc fe ff ff    	mov    -0x104(%ebp),%edx
80100cb8:	8b 85 f8 fe ff ff    	mov    -0x108(%ebp),%eax
80100cbe:	39 c2                	cmp    %eax,%edx
80100cc0:	0f 82 ef 02 00 00    	jb     80100fb5 <exec+0x3f2>
      goto bad;
    if(ph.vaddr + ph.memsz < ph.vaddr)
80100cc6:	8b 95 f0 fe ff ff    	mov    -0x110(%ebp),%edx
80100ccc:	8b 85 fc fe ff ff    	mov    -0x104(%ebp),%eax
80100cd2:	01 c2                	add    %eax,%edx
80100cd4:	8b 85 f0 fe ff ff    	mov    -0x110(%ebp),%eax
80100cda:	39 c2                	cmp    %eax,%edx
80100cdc:	0f 82 d6 02 00 00    	jb     80100fb8 <exec+0x3f5>
      goto bad;
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100ce2:	8b 95 f0 fe ff ff    	mov    -0x110(%ebp),%edx
80100ce8:	8b 85 fc fe ff ff    	mov    -0x104(%ebp),%eax
80100cee:	01 d0                	add    %edx,%eax
80100cf0:	83 ec 04             	sub    $0x4,%esp
80100cf3:	50                   	push   %eax
80100cf4:	ff 75 e0             	push   -0x20(%ebp)
80100cf7:	ff 75 d4             	push   -0x2c(%ebp)
80100cfa:	e8 47 72 00 00       	call   80107f46 <allocuvm>
80100cff:	83 c4 10             	add    $0x10,%esp
80100d02:	89 45 e0             	mov    %eax,-0x20(%ebp)
80100d05:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80100d09:	0f 84 ac 02 00 00    	je     80100fbb <exec+0x3f8>
      goto bad;
    if(ph.vaddr % PGSIZE != 0)
80100d0f:	8b 85 f0 fe ff ff    	mov    -0x110(%ebp),%eax
80100d15:	25 ff 0f 00 00       	and    $0xfff,%eax
80100d1a:	85 c0                	test   %eax,%eax
80100d1c:	0f 85 9c 02 00 00    	jne    80100fbe <exec+0x3fb>
      goto bad;
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100d22:	8b 95 f8 fe ff ff    	mov    -0x108(%ebp),%edx
80100d28:	8b 85 ec fe ff ff    	mov    -0x114(%ebp),%eax
80100d2e:	8b 8d f0 fe ff ff    	mov    -0x110(%ebp),%ecx
80100d34:	83 ec 0c             	sub    $0xc,%esp
80100d37:	52                   	push   %edx
80100d38:	50                   	push   %eax
80100d39:	ff 75 d8             	push   -0x28(%ebp)
80100d3c:	51                   	push   %ecx
80100d3d:	ff 75 d4             	push   -0x2c(%ebp)
80100d40:	e8 34 71 00 00       	call   80107e79 <loaduvm>
80100d45:	83 c4 20             	add    $0x20,%esp
80100d48:	85 c0                	test   %eax,%eax
80100d4a:	0f 88 71 02 00 00    	js     80100fc1 <exec+0x3fe>
80100d50:	eb 01                	jmp    80100d53 <exec+0x190>
      continue;
80100d52:	90                   	nop
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100d53:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
80100d57:	8b 45 e8             	mov    -0x18(%ebp),%eax
80100d5a:	83 c0 20             	add    $0x20,%eax
80100d5d:	89 45 e8             	mov    %eax,-0x18(%ebp)
80100d60:	0f b7 85 34 ff ff ff 	movzwl -0xcc(%ebp),%eax
80100d67:	0f b7 c0             	movzwl %ax,%eax
80100d6a:	39 45 ec             	cmp    %eax,-0x14(%ebp)
80100d6d:	0f 8c 0f ff ff ff    	jl     80100c82 <exec+0xbf>
      goto bad;
  }
  iunlockput(ip);
80100d73:	83 ec 0c             	sub    $0xc,%esp
80100d76:	ff 75 d8             	push   -0x28(%ebp)
80100d79:	e8 e0 0e 00 00       	call   80101c5e <iunlockput>
80100d7e:	83 c4 10             	add    $0x10,%esp
  end_op();
80100d81:	e8 65 28 00 00       	call   801035eb <end_op>
  ip = 0;
80100d86:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)

  // Allocate two pages at the next page boundary.
  // Make the first inaccessible.  Use the second as the user stack.
  sz = PGROUNDUP(sz);
80100d8d:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100d90:	05 ff 0f 00 00       	add    $0xfff,%eax
80100d95:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80100d9a:	89 45 e0             	mov    %eax,-0x20(%ebp)
  if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100d9d:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100da0:	05 00 20 00 00       	add    $0x2000,%eax
80100da5:	83 ec 04             	sub    $0x4,%esp
80100da8:	50                   	push   %eax
80100da9:	ff 75 e0             	push   -0x20(%ebp)
80100dac:	ff 75 d4             	push   -0x2c(%ebp)
80100daf:	e8 92 71 00 00       	call   80107f46 <allocuvm>
80100db4:	83 c4 10             	add    $0x10,%esp
80100db7:	89 45 e0             	mov    %eax,-0x20(%ebp)
80100dba:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80100dbe:	0f 84 00 02 00 00    	je     80100fc4 <exec+0x401>
    goto bad;
  clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100dc4:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100dc7:	2d 00 20 00 00       	sub    $0x2000,%eax
80100dcc:	83 ec 08             	sub    $0x8,%esp
80100dcf:	50                   	push   %eax
80100dd0:	ff 75 d4             	push   -0x2c(%ebp)
80100dd3:	e8 d0 73 00 00       	call   801081a8 <clearpteu>
80100dd8:	83 c4 10             	add    $0x10,%esp
  sp = sz;
80100ddb:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100dde:	89 45 dc             	mov    %eax,-0x24(%ebp)

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
80100de1:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
80100de8:	e9 96 00 00 00       	jmp    80100e83 <exec+0x2c0>
    if(argc >= MAXARG)
80100ded:	83 7d e4 1f          	cmpl   $0x1f,-0x1c(%ebp)
80100df1:	0f 87 d0 01 00 00    	ja     80100fc7 <exec+0x404>
      goto bad;
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100df7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dfa:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100e01:	8b 45 0c             	mov    0xc(%ebp),%eax
80100e04:	01 d0                	add    %edx,%eax
80100e06:	8b 00                	mov    (%eax),%eax
80100e08:	83 ec 0c             	sub    $0xc,%esp
80100e0b:	50                   	push   %eax
80100e0c:	e8 6d 46 00 00       	call   8010547e <strlen>
80100e11:	83 c4 10             	add    $0x10,%esp
80100e14:	89 c2                	mov    %eax,%edx
80100e16:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100e19:	29 d0                	sub    %edx,%eax
80100e1b:	83 e8 01             	sub    $0x1,%eax
80100e1e:	83 e0 fc             	and    $0xfffffffc,%eax
80100e21:	89 45 dc             	mov    %eax,-0x24(%ebp)
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100e24:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100e27:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100e2e:	8b 45 0c             	mov    0xc(%ebp),%eax
80100e31:	01 d0                	add    %edx,%eax
80100e33:	8b 00                	mov    (%eax),%eax
80100e35:	83 ec 0c             	sub    $0xc,%esp
80100e38:	50                   	push   %eax
80100e39:	e8 40 46 00 00       	call   8010547e <strlen>
80100e3e:	83 c4 10             	add    $0x10,%esp
80100e41:	83 c0 01             	add    $0x1,%eax
80100e44:	89 c2                	mov    %eax,%edx
80100e46:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100e49:	8d 0c 85 00 00 00 00 	lea    0x0(,%eax,4),%ecx
80100e50:	8b 45 0c             	mov    0xc(%ebp),%eax
80100e53:	01 c8                	add    %ecx,%eax
80100e55:	8b 00                	mov    (%eax),%eax
80100e57:	52                   	push   %edx
80100e58:	50                   	push   %eax
80100e59:	ff 75 dc             	push   -0x24(%ebp)
80100e5c:	ff 75 d4             	push   -0x2c(%ebp)
80100e5f:	e8 d9 74 00 00       	call   8010833d <copyout>
80100e64:	83 c4 10             	add    $0x10,%esp
80100e67:	85 c0                	test   %eax,%eax
80100e69:	0f 88 5b 01 00 00    	js     80100fca <exec+0x407>
      goto bad;
    ustack[3+argc] = sp;
80100e6f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100e72:	8d 50 03             	lea    0x3(%eax),%edx
80100e75:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100e78:	89 84 95 3c ff ff ff 	mov    %eax,-0xc4(%ebp,%edx,4)
  for(argc = 0; argv[argc]; argc++) {
80100e7f:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
80100e83:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100e86:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100e8d:	8b 45 0c             	mov    0xc(%ebp),%eax
80100e90:	01 d0                	add    %edx,%eax
80100e92:	8b 00                	mov    (%eax),%eax
80100e94:	85 c0                	test   %eax,%eax
80100e96:	0f 85 51 ff ff ff    	jne    80100ded <exec+0x22a>
  }
  ustack[3+argc] = 0;
80100e9c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100e9f:	83 c0 03             	add    $0x3,%eax
80100ea2:	c7 84 85 3c ff ff ff 	movl   $0x0,-0xc4(%ebp,%eax,4)
80100ea9:	00 00 00 00 

  ustack[0] = 0xffffffff;  // fake return PC
80100ead:	c7 85 3c ff ff ff ff 	movl   $0xffffffff,-0xc4(%ebp)
80100eb4:	ff ff ff 
  ustack[1] = argc;
80100eb7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100eba:	89 85 40 ff ff ff    	mov    %eax,-0xc0(%ebp)
  ustack[2] = sp - (argc+1)*4;  // argv pointer
80100ec0:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100ec3:	83 c0 01             	add    $0x1,%eax
80100ec6:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100ecd:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100ed0:	29 d0                	sub    %edx,%eax
80100ed2:	89 85 44 ff ff ff    	mov    %eax,-0xbc(%ebp)

  sp -= (3+argc+1) * 4;
80100ed8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100edb:	83 c0 04             	add    $0x4,%eax
80100ede:	c1 e0 02             	shl    $0x2,%eax
80100ee1:	29 45 dc             	sub    %eax,-0x24(%ebp)
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100ee4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100ee7:	83 c0 04             	add    $0x4,%eax
80100eea:	c1 e0 02             	shl    $0x2,%eax
80100eed:	50                   	push   %eax
80100eee:	8d 85 3c ff ff ff    	lea    -0xc4(%ebp),%eax
80100ef4:	50                   	push   %eax
80100ef5:	ff 75 dc             	push   -0x24(%ebp)
80100ef8:	ff 75 d4             	push   -0x2c(%ebp)
80100efb:	e8 3d 74 00 00       	call   8010833d <copyout>
80100f00:	83 c4 10             	add    $0x10,%esp
80100f03:	85 c0                	test   %eax,%eax
80100f05:	0f 88 c2 00 00 00    	js     80100fcd <exec+0x40a>
    goto bad;

  // Save program name for debugging.
  for(last=s=path; *s; s++)
80100f0b:	8b 45 08             	mov    0x8(%ebp),%eax
80100f0e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100f11:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f14:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100f17:	eb 17                	jmp    80100f30 <exec+0x36d>
    if(*s == '/')
80100f19:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f1c:	0f b6 00             	movzbl (%eax),%eax
80100f1f:	3c 2f                	cmp    $0x2f,%al
80100f21:	75 09                	jne    80100f2c <exec+0x369>
      last = s+1;
80100f23:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f26:	83 c0 01             	add    $0x1,%eax
80100f29:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(last=s=path; *s; s++)
80100f2c:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100f30:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f33:	0f b6 00             	movzbl (%eax),%eax
80100f36:	84 c0                	test   %al,%al
80100f38:	75 df                	jne    80100f19 <exec+0x356>
  safestrcpy(curproc->name, last, sizeof(curproc->name));
80100f3a:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100f3d:	83 c0 6c             	add    $0x6c,%eax
80100f40:	83 ec 04             	sub    $0x4,%esp
80100f43:	6a 10                	push   $0x10
80100f45:	ff 75 f0             	push   -0x10(%ebp)
80100f48:	50                   	push   %eax
80100f49:	e8 e5 44 00 00       	call   80105433 <safestrcpy>
80100f4e:	83 c4 10             	add    $0x10,%esp

  // Commit to the user image.
  oldpgdir = curproc->pgdir;
80100f51:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100f54:	8b 40 04             	mov    0x4(%eax),%eax
80100f57:	89 45 cc             	mov    %eax,-0x34(%ebp)
  curproc->pgdir = pgdir;
80100f5a:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100f5d:	8b 55 d4             	mov    -0x2c(%ebp),%edx
80100f60:	89 50 04             	mov    %edx,0x4(%eax)
  curproc->sz = sz;
80100f63:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100f66:	8b 55 e0             	mov    -0x20(%ebp),%edx
80100f69:	89 10                	mov    %edx,(%eax)
  curproc->tf->eip = elf.entry;  // main
80100f6b:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100f6e:	8b 40 18             	mov    0x18(%eax),%eax
80100f71:	8b 95 20 ff ff ff    	mov    -0xe0(%ebp),%edx
80100f77:	89 50 38             	mov    %edx,0x38(%eax)
  curproc->tf->esp = sp;
80100f7a:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100f7d:	8b 40 18             	mov    0x18(%eax),%eax
80100f80:	8b 55 dc             	mov    -0x24(%ebp),%edx
80100f83:	89 50 44             	mov    %edx,0x44(%eax)
  switchuvm(curproc);
80100f86:	83 ec 0c             	sub    $0xc,%esp
80100f89:	ff 75 d0             	push   -0x30(%ebp)
80100f8c:	e8 d9 6c 00 00       	call   80107c6a <switchuvm>
80100f91:	83 c4 10             	add    $0x10,%esp
  freevm(oldpgdir);
80100f94:	83 ec 0c             	sub    $0xc,%esp
80100f97:	ff 75 cc             	push   -0x34(%ebp)
80100f9a:	e8 70 71 00 00       	call   8010810f <freevm>
80100f9f:	83 c4 10             	add    $0x10,%esp
  return 0;
80100fa2:	b8 00 00 00 00       	mov    $0x0,%eax
80100fa7:	eb 57                	jmp    80101000 <exec+0x43d>
    goto bad;
80100fa9:	90                   	nop
80100faa:	eb 22                	jmp    80100fce <exec+0x40b>
    goto bad;
80100fac:	90                   	nop
80100fad:	eb 1f                	jmp    80100fce <exec+0x40b>
    goto bad;
80100faf:	90                   	nop
80100fb0:	eb 1c                	jmp    80100fce <exec+0x40b>
      goto bad;
80100fb2:	90                   	nop
80100fb3:	eb 19                	jmp    80100fce <exec+0x40b>
      goto bad;
80100fb5:	90                   	nop
80100fb6:	eb 16                	jmp    80100fce <exec+0x40b>
      goto bad;
80100fb8:	90                   	nop
80100fb9:	eb 13                	jmp    80100fce <exec+0x40b>
      goto bad;
80100fbb:	90                   	nop
80100fbc:	eb 10                	jmp    80100fce <exec+0x40b>
      goto bad;
80100fbe:	90                   	nop
80100fbf:	eb 0d                	jmp    80100fce <exec+0x40b>
      goto bad;
80100fc1:	90                   	nop
80100fc2:	eb 0a                	jmp    80100fce <exec+0x40b>
    goto bad;
80100fc4:	90                   	nop
80100fc5:	eb 07                	jmp    80100fce <exec+0x40b>
      goto bad;
80100fc7:	90                   	nop
80100fc8:	eb 04                	jmp    80100fce <exec+0x40b>
      goto bad;
80100fca:	90                   	nop
80100fcb:	eb 01                	jmp    80100fce <exec+0x40b>
    goto bad;
80100fcd:	90                   	nop

 bad:
  if(pgdir)
80100fce:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
80100fd2:	74 0e                	je     80100fe2 <exec+0x41f>
    freevm(pgdir);
80100fd4:	83 ec 0c             	sub    $0xc,%esp
80100fd7:	ff 75 d4             	push   -0x2c(%ebp)
80100fda:	e8 30 71 00 00       	call   8010810f <freevm>
80100fdf:	83 c4 10             	add    $0x10,%esp
  if(ip){
80100fe2:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
80100fe6:	74 13                	je     80100ffb <exec+0x438>
    iunlockput(ip);
80100fe8:	83 ec 0c             	sub    $0xc,%esp
80100feb:	ff 75 d8             	push   -0x28(%ebp)
80100fee:	e8 6b 0c 00 00       	call   80101c5e <iunlockput>
80100ff3:	83 c4 10             	add    $0x10,%esp
    end_op();
80100ff6:	e8 f0 25 00 00       	call   801035eb <end_op>
  }
  return -1;
80100ffb:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80101000:	c9                   	leave  
80101001:	c3                   	ret    

80101002 <fileinit>:
  struct file file[NFILE];
} ftable;

void
fileinit(void)
{
80101002:	55                   	push   %ebp
80101003:	89 e5                	mov    %esp,%ebp
80101005:	83 ec 08             	sub    $0x8,%esp
  initlock(&ftable.lock, "ftable");
80101008:	83 ec 08             	sub    $0x8,%esp
8010100b:	68 06 85 10 80       	push   $0x80108506
80101010:	68 20 00 11 80       	push   $0x80110020
80101015:	e8 7e 3f 00 00       	call   80104f98 <initlock>
8010101a:	83 c4 10             	add    $0x10,%esp
}
8010101d:	90                   	nop
8010101e:	c9                   	leave  
8010101f:	c3                   	ret    

80101020 <filealloc>:

// Allocate a file structure.
struct file*
filealloc(void)
{
80101020:	55                   	push   %ebp
80101021:	89 e5                	mov    %esp,%ebp
80101023:	83 ec 18             	sub    $0x18,%esp
  struct file *f;

  acquire(&ftable.lock);
80101026:	83 ec 0c             	sub    $0xc,%esp
80101029:	68 20 00 11 80       	push   $0x80110020
8010102e:	e8 87 3f 00 00       	call   80104fba <acquire>
80101033:	83 c4 10             	add    $0x10,%esp
  for(f = ftable.file; f < ftable.file + NFILE; f++){
80101036:	c7 45 f4 54 00 11 80 	movl   $0x80110054,-0xc(%ebp)
8010103d:	eb 2d                	jmp    8010106c <filealloc+0x4c>
    if(f->ref == 0){
8010103f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101042:	8b 40 04             	mov    0x4(%eax),%eax
80101045:	85 c0                	test   %eax,%eax
80101047:	75 1f                	jne    80101068 <filealloc+0x48>
      f->ref = 1;
80101049:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010104c:	c7 40 04 01 00 00 00 	movl   $0x1,0x4(%eax)
      release(&ftable.lock);
80101053:	83 ec 0c             	sub    $0xc,%esp
80101056:	68 20 00 11 80       	push   $0x80110020
8010105b:	e8 c8 3f 00 00       	call   80105028 <release>
80101060:	83 c4 10             	add    $0x10,%esp
      return f;
80101063:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101066:	eb 23                	jmp    8010108b <filealloc+0x6b>
  for(f = ftable.file; f < ftable.file + NFILE; f++){
80101068:	83 45 f4 18          	addl   $0x18,-0xc(%ebp)
8010106c:	b8 b4 09 11 80       	mov    $0x801109b4,%eax
80101071:	39 45 f4             	cmp    %eax,-0xc(%ebp)
80101074:	72 c9                	jb     8010103f <filealloc+0x1f>
    }
  }
  release(&ftable.lock);
80101076:	83 ec 0c             	sub    $0xc,%esp
80101079:	68 20 00 11 80       	push   $0x80110020
8010107e:	e8 a5 3f 00 00       	call   80105028 <release>
80101083:	83 c4 10             	add    $0x10,%esp
  return 0;
80101086:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010108b:	c9                   	leave  
8010108c:	c3                   	ret    

8010108d <filedup>:

// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
8010108d:	55                   	push   %ebp
8010108e:	89 e5                	mov    %esp,%ebp
80101090:	83 ec 08             	sub    $0x8,%esp
  acquire(&ftable.lock);
80101093:	83 ec 0c             	sub    $0xc,%esp
80101096:	68 20 00 11 80       	push   $0x80110020
8010109b:	e8 1a 3f 00 00       	call   80104fba <acquire>
801010a0:	83 c4 10             	add    $0x10,%esp
  if(f->ref < 1)
801010a3:	8b 45 08             	mov    0x8(%ebp),%eax
801010a6:	8b 40 04             	mov    0x4(%eax),%eax
801010a9:	85 c0                	test   %eax,%eax
801010ab:	7f 0d                	jg     801010ba <filedup+0x2d>
    panic("filedup");
801010ad:	83 ec 0c             	sub    $0xc,%esp
801010b0:	68 0d 85 10 80       	push   $0x8010850d
801010b5:	e8 fb f4 ff ff       	call   801005b5 <panic>
  f->ref++;
801010ba:	8b 45 08             	mov    0x8(%ebp),%eax
801010bd:	8b 40 04             	mov    0x4(%eax),%eax
801010c0:	8d 50 01             	lea    0x1(%eax),%edx
801010c3:	8b 45 08             	mov    0x8(%ebp),%eax
801010c6:	89 50 04             	mov    %edx,0x4(%eax)
  release(&ftable.lock);
801010c9:	83 ec 0c             	sub    $0xc,%esp
801010cc:	68 20 00 11 80       	push   $0x80110020
801010d1:	e8 52 3f 00 00       	call   80105028 <release>
801010d6:	83 c4 10             	add    $0x10,%esp
  return f;
801010d9:	8b 45 08             	mov    0x8(%ebp),%eax
}
801010dc:	c9                   	leave  
801010dd:	c3                   	ret    

801010de <fileclose>:

// Close file f.  (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
801010de:	55                   	push   %ebp
801010df:	89 e5                	mov    %esp,%ebp
801010e1:	83 ec 28             	sub    $0x28,%esp
  struct file ff;

  acquire(&ftable.lock);
801010e4:	83 ec 0c             	sub    $0xc,%esp
801010e7:	68 20 00 11 80       	push   $0x80110020
801010ec:	e8 c9 3e 00 00       	call   80104fba <acquire>
801010f1:	83 c4 10             	add    $0x10,%esp
  if(f->ref < 1)
801010f4:	8b 45 08             	mov    0x8(%ebp),%eax
801010f7:	8b 40 04             	mov    0x4(%eax),%eax
801010fa:	85 c0                	test   %eax,%eax
801010fc:	7f 0d                	jg     8010110b <fileclose+0x2d>
    panic("fileclose");
801010fe:	83 ec 0c             	sub    $0xc,%esp
80101101:	68 15 85 10 80       	push   $0x80108515
80101106:	e8 aa f4 ff ff       	call   801005b5 <panic>
  if(--f->ref > 0){
8010110b:	8b 45 08             	mov    0x8(%ebp),%eax
8010110e:	8b 40 04             	mov    0x4(%eax),%eax
80101111:	8d 50 ff             	lea    -0x1(%eax),%edx
80101114:	8b 45 08             	mov    0x8(%ebp),%eax
80101117:	89 50 04             	mov    %edx,0x4(%eax)
8010111a:	8b 45 08             	mov    0x8(%ebp),%eax
8010111d:	8b 40 04             	mov    0x4(%eax),%eax
80101120:	85 c0                	test   %eax,%eax
80101122:	7e 15                	jle    80101139 <fileclose+0x5b>
    release(&ftable.lock);
80101124:	83 ec 0c             	sub    $0xc,%esp
80101127:	68 20 00 11 80       	push   $0x80110020
8010112c:	e8 f7 3e 00 00       	call   80105028 <release>
80101131:	83 c4 10             	add    $0x10,%esp
80101134:	e9 8b 00 00 00       	jmp    801011c4 <fileclose+0xe6>
    return;
  }
  ff = *f;
80101139:	8b 45 08             	mov    0x8(%ebp),%eax
8010113c:	8b 10                	mov    (%eax),%edx
8010113e:	89 55 e0             	mov    %edx,-0x20(%ebp)
80101141:	8b 50 04             	mov    0x4(%eax),%edx
80101144:	89 55 e4             	mov    %edx,-0x1c(%ebp)
80101147:	8b 50 08             	mov    0x8(%eax),%edx
8010114a:	89 55 e8             	mov    %edx,-0x18(%ebp)
8010114d:	8b 50 0c             	mov    0xc(%eax),%edx
80101150:	89 55 ec             	mov    %edx,-0x14(%ebp)
80101153:	8b 50 10             	mov    0x10(%eax),%edx
80101156:	89 55 f0             	mov    %edx,-0x10(%ebp)
80101159:	8b 40 14             	mov    0x14(%eax),%eax
8010115c:	89 45 f4             	mov    %eax,-0xc(%ebp)
  f->ref = 0;
8010115f:	8b 45 08             	mov    0x8(%ebp),%eax
80101162:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
  f->type = FD_NONE;
80101169:	8b 45 08             	mov    0x8(%ebp),%eax
8010116c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  release(&ftable.lock);
80101172:	83 ec 0c             	sub    $0xc,%esp
80101175:	68 20 00 11 80       	push   $0x80110020
8010117a:	e8 a9 3e 00 00       	call   80105028 <release>
8010117f:	83 c4 10             	add    $0x10,%esp

  if(ff.type == FD_PIPE)
80101182:	8b 45 e0             	mov    -0x20(%ebp),%eax
80101185:	83 f8 01             	cmp    $0x1,%eax
80101188:	75 19                	jne    801011a3 <fileclose+0xc5>
    pipeclose(ff.pipe, ff.writable);
8010118a:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
8010118e:	0f be d0             	movsbl %al,%edx
80101191:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101194:	83 ec 08             	sub    $0x8,%esp
80101197:	52                   	push   %edx
80101198:	50                   	push   %eax
80101199:	e8 cd 2d 00 00       	call   80103f6b <pipeclose>
8010119e:	83 c4 10             	add    $0x10,%esp
801011a1:	eb 21                	jmp    801011c4 <fileclose+0xe6>
  else if(ff.type == FD_INODE){
801011a3:	8b 45 e0             	mov    -0x20(%ebp),%eax
801011a6:	83 f8 02             	cmp    $0x2,%eax
801011a9:	75 19                	jne    801011c4 <fileclose+0xe6>
    begin_op();
801011ab:	e8 af 23 00 00       	call   8010355f <begin_op>
    iput(ff.ip);
801011b0:	8b 45 f0             	mov    -0x10(%ebp),%eax
801011b3:	83 ec 0c             	sub    $0xc,%esp
801011b6:	50                   	push   %eax
801011b7:	e8 d2 09 00 00       	call   80101b8e <iput>
801011bc:	83 c4 10             	add    $0x10,%esp
    end_op();
801011bf:	e8 27 24 00 00       	call   801035eb <end_op>
  }
}
801011c4:	c9                   	leave  
801011c5:	c3                   	ret    

801011c6 <filestat>:

// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
801011c6:	55                   	push   %ebp
801011c7:	89 e5                	mov    %esp,%ebp
801011c9:	83 ec 08             	sub    $0x8,%esp
  if(f->type == FD_INODE){
801011cc:	8b 45 08             	mov    0x8(%ebp),%eax
801011cf:	8b 00                	mov    (%eax),%eax
801011d1:	83 f8 02             	cmp    $0x2,%eax
801011d4:	75 40                	jne    80101216 <filestat+0x50>
    ilock(f->ip);
801011d6:	8b 45 08             	mov    0x8(%ebp),%eax
801011d9:	8b 40 10             	mov    0x10(%eax),%eax
801011dc:	83 ec 0c             	sub    $0xc,%esp
801011df:	50                   	push   %eax
801011e0:	e8 48 08 00 00       	call   80101a2d <ilock>
801011e5:	83 c4 10             	add    $0x10,%esp
    stati(f->ip, st);
801011e8:	8b 45 08             	mov    0x8(%ebp),%eax
801011eb:	8b 40 10             	mov    0x10(%eax),%eax
801011ee:	83 ec 08             	sub    $0x8,%esp
801011f1:	ff 75 0c             	push   0xc(%ebp)
801011f4:	50                   	push   %eax
801011f5:	e8 d9 0c 00 00       	call   80101ed3 <stati>
801011fa:	83 c4 10             	add    $0x10,%esp
    iunlock(f->ip);
801011fd:	8b 45 08             	mov    0x8(%ebp),%eax
80101200:	8b 40 10             	mov    0x10(%eax),%eax
80101203:	83 ec 0c             	sub    $0xc,%esp
80101206:	50                   	push   %eax
80101207:	e8 34 09 00 00       	call   80101b40 <iunlock>
8010120c:	83 c4 10             	add    $0x10,%esp
    return 0;
8010120f:	b8 00 00 00 00       	mov    $0x0,%eax
80101214:	eb 05                	jmp    8010121b <filestat+0x55>
  }
  return -1;
80101216:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
8010121b:	c9                   	leave  
8010121c:	c3                   	ret    

8010121d <fileread>:

// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
8010121d:	55                   	push   %ebp
8010121e:	89 e5                	mov    %esp,%ebp
80101220:	83 ec 18             	sub    $0x18,%esp
  int r;

  if(f->readable == 0)
80101223:	8b 45 08             	mov    0x8(%ebp),%eax
80101226:	0f b6 40 08          	movzbl 0x8(%eax),%eax
8010122a:	84 c0                	test   %al,%al
8010122c:	75 0a                	jne    80101238 <fileread+0x1b>
    return -1;
8010122e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101233:	e9 9b 00 00 00       	jmp    801012d3 <fileread+0xb6>
  if(f->type == FD_PIPE)
80101238:	8b 45 08             	mov    0x8(%ebp),%eax
8010123b:	8b 00                	mov    (%eax),%eax
8010123d:	83 f8 01             	cmp    $0x1,%eax
80101240:	75 1a                	jne    8010125c <fileread+0x3f>
    return piperead(f->pipe, addr, n);
80101242:	8b 45 08             	mov    0x8(%ebp),%eax
80101245:	8b 40 0c             	mov    0xc(%eax),%eax
80101248:	83 ec 04             	sub    $0x4,%esp
8010124b:	ff 75 10             	push   0x10(%ebp)
8010124e:	ff 75 0c             	push   0xc(%ebp)
80101251:	50                   	push   %eax
80101252:	e8 c1 2e 00 00       	call   80104118 <piperead>
80101257:	83 c4 10             	add    $0x10,%esp
8010125a:	eb 77                	jmp    801012d3 <fileread+0xb6>
  if(f->type == FD_INODE){
8010125c:	8b 45 08             	mov    0x8(%ebp),%eax
8010125f:	8b 00                	mov    (%eax),%eax
80101261:	83 f8 02             	cmp    $0x2,%eax
80101264:	75 60                	jne    801012c6 <fileread+0xa9>
    ilock(f->ip);
80101266:	8b 45 08             	mov    0x8(%ebp),%eax
80101269:	8b 40 10             	mov    0x10(%eax),%eax
8010126c:	83 ec 0c             	sub    $0xc,%esp
8010126f:	50                   	push   %eax
80101270:	e8 b8 07 00 00       	call   80101a2d <ilock>
80101275:	83 c4 10             	add    $0x10,%esp
    if((r = readi(f->ip, addr, f->off, n)) > 0)
80101278:	8b 4d 10             	mov    0x10(%ebp),%ecx
8010127b:	8b 45 08             	mov    0x8(%ebp),%eax
8010127e:	8b 50 14             	mov    0x14(%eax),%edx
80101281:	8b 45 08             	mov    0x8(%ebp),%eax
80101284:	8b 40 10             	mov    0x10(%eax),%eax
80101287:	51                   	push   %ecx
80101288:	52                   	push   %edx
80101289:	ff 75 0c             	push   0xc(%ebp)
8010128c:	50                   	push   %eax
8010128d:	e8 87 0c 00 00       	call   80101f19 <readi>
80101292:	83 c4 10             	add    $0x10,%esp
80101295:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101298:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010129c:	7e 11                	jle    801012af <fileread+0x92>
      f->off += r;
8010129e:	8b 45 08             	mov    0x8(%ebp),%eax
801012a1:	8b 50 14             	mov    0x14(%eax),%edx
801012a4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801012a7:	01 c2                	add    %eax,%edx
801012a9:	8b 45 08             	mov    0x8(%ebp),%eax
801012ac:	89 50 14             	mov    %edx,0x14(%eax)
    iunlock(f->ip);
801012af:	8b 45 08             	mov    0x8(%ebp),%eax
801012b2:	8b 40 10             	mov    0x10(%eax),%eax
801012b5:	83 ec 0c             	sub    $0xc,%esp
801012b8:	50                   	push   %eax
801012b9:	e8 82 08 00 00       	call   80101b40 <iunlock>
801012be:	83 c4 10             	add    $0x10,%esp
    return r;
801012c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801012c4:	eb 0d                	jmp    801012d3 <fileread+0xb6>
  }
  panic("fileread");
801012c6:	83 ec 0c             	sub    $0xc,%esp
801012c9:	68 1f 85 10 80       	push   $0x8010851f
801012ce:	e8 e2 f2 ff ff       	call   801005b5 <panic>
}
801012d3:	c9                   	leave  
801012d4:	c3                   	ret    

801012d5 <filewrite>:

//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
801012d5:	55                   	push   %ebp
801012d6:	89 e5                	mov    %esp,%ebp
801012d8:	53                   	push   %ebx
801012d9:	83 ec 14             	sub    $0x14,%esp
  int r;

  if(f->writable == 0)
801012dc:	8b 45 08             	mov    0x8(%ebp),%eax
801012df:	0f b6 40 09          	movzbl 0x9(%eax),%eax
801012e3:	84 c0                	test   %al,%al
801012e5:	75 0a                	jne    801012f1 <filewrite+0x1c>
    return -1;
801012e7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801012ec:	e9 1b 01 00 00       	jmp    8010140c <filewrite+0x137>
  if(f->type == FD_PIPE)
801012f1:	8b 45 08             	mov    0x8(%ebp),%eax
801012f4:	8b 00                	mov    (%eax),%eax
801012f6:	83 f8 01             	cmp    $0x1,%eax
801012f9:	75 1d                	jne    80101318 <filewrite+0x43>
    return pipewrite(f->pipe, addr, n);
801012fb:	8b 45 08             	mov    0x8(%ebp),%eax
801012fe:	8b 40 0c             	mov    0xc(%eax),%eax
80101301:	83 ec 04             	sub    $0x4,%esp
80101304:	ff 75 10             	push   0x10(%ebp)
80101307:	ff 75 0c             	push   0xc(%ebp)
8010130a:	50                   	push   %eax
8010130b:	e8 06 2d 00 00       	call   80104016 <pipewrite>
80101310:	83 c4 10             	add    $0x10,%esp
80101313:	e9 f4 00 00 00       	jmp    8010140c <filewrite+0x137>
  if(f->type == FD_INODE){
80101318:	8b 45 08             	mov    0x8(%ebp),%eax
8010131b:	8b 00                	mov    (%eax),%eax
8010131d:	83 f8 02             	cmp    $0x2,%eax
80101320:	0f 85 d9 00 00 00    	jne    801013ff <filewrite+0x12a>
    // the maximum log transaction size, including
    // i-node, indirect block, allocation blocks,
    // and 2 blocks of slop for non-aligned writes.
    // this really belongs lower down, since writei()
    // might be writing a device like the console.
    int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512;
80101326:	c7 45 ec 00 06 00 00 	movl   $0x600,-0x14(%ebp)
    int i = 0;
8010132d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while(i < n){
80101334:	e9 a3 00 00 00       	jmp    801013dc <filewrite+0x107>
      int n1 = n - i;
80101339:	8b 45 10             	mov    0x10(%ebp),%eax
8010133c:	2b 45 f4             	sub    -0xc(%ebp),%eax
8010133f:	89 45 f0             	mov    %eax,-0x10(%ebp)
      if(n1 > max)
80101342:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101345:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80101348:	7e 06                	jle    80101350 <filewrite+0x7b>
        n1 = max;
8010134a:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010134d:	89 45 f0             	mov    %eax,-0x10(%ebp)

      begin_op();
80101350:	e8 0a 22 00 00       	call   8010355f <begin_op>
      ilock(f->ip);
80101355:	8b 45 08             	mov    0x8(%ebp),%eax
80101358:	8b 40 10             	mov    0x10(%eax),%eax
8010135b:	83 ec 0c             	sub    $0xc,%esp
8010135e:	50                   	push   %eax
8010135f:	e8 c9 06 00 00       	call   80101a2d <ilock>
80101364:	83 c4 10             	add    $0x10,%esp
      if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101367:	8b 4d f0             	mov    -0x10(%ebp),%ecx
8010136a:	8b 45 08             	mov    0x8(%ebp),%eax
8010136d:	8b 50 14             	mov    0x14(%eax),%edx
80101370:	8b 5d f4             	mov    -0xc(%ebp),%ebx
80101373:	8b 45 0c             	mov    0xc(%ebp),%eax
80101376:	01 c3                	add    %eax,%ebx
80101378:	8b 45 08             	mov    0x8(%ebp),%eax
8010137b:	8b 40 10             	mov    0x10(%eax),%eax
8010137e:	51                   	push   %ecx
8010137f:	52                   	push   %edx
80101380:	53                   	push   %ebx
80101381:	50                   	push   %eax
80101382:	e8 e7 0c 00 00       	call   8010206e <writei>
80101387:	83 c4 10             	add    $0x10,%esp
8010138a:	89 45 e8             	mov    %eax,-0x18(%ebp)
8010138d:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
80101391:	7e 11                	jle    801013a4 <filewrite+0xcf>
        f->off += r;
80101393:	8b 45 08             	mov    0x8(%ebp),%eax
80101396:	8b 50 14             	mov    0x14(%eax),%edx
80101399:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010139c:	01 c2                	add    %eax,%edx
8010139e:	8b 45 08             	mov    0x8(%ebp),%eax
801013a1:	89 50 14             	mov    %edx,0x14(%eax)
      iunlock(f->ip);
801013a4:	8b 45 08             	mov    0x8(%ebp),%eax
801013a7:	8b 40 10             	mov    0x10(%eax),%eax
801013aa:	83 ec 0c             	sub    $0xc,%esp
801013ad:	50                   	push   %eax
801013ae:	e8 8d 07 00 00       	call   80101b40 <iunlock>
801013b3:	83 c4 10             	add    $0x10,%esp
      end_op();
801013b6:	e8 30 22 00 00       	call   801035eb <end_op>

      if(r < 0)
801013bb:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801013bf:	78 29                	js     801013ea <filewrite+0x115>
        break;
      if(r != n1)
801013c1:	8b 45 e8             	mov    -0x18(%ebp),%eax
801013c4:	3b 45 f0             	cmp    -0x10(%ebp),%eax
801013c7:	74 0d                	je     801013d6 <filewrite+0x101>
        panic("short filewrite");
801013c9:	83 ec 0c             	sub    $0xc,%esp
801013cc:	68 28 85 10 80       	push   $0x80108528
801013d1:	e8 df f1 ff ff       	call   801005b5 <panic>
      i += r;
801013d6:	8b 45 e8             	mov    -0x18(%ebp),%eax
801013d9:	01 45 f4             	add    %eax,-0xc(%ebp)
    while(i < n){
801013dc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801013df:	3b 45 10             	cmp    0x10(%ebp),%eax
801013e2:	0f 8c 51 ff ff ff    	jl     80101339 <filewrite+0x64>
801013e8:	eb 01                	jmp    801013eb <filewrite+0x116>
        break;
801013ea:	90                   	nop
    }
    return i == n ? n : -1;
801013eb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801013ee:	3b 45 10             	cmp    0x10(%ebp),%eax
801013f1:	75 05                	jne    801013f8 <filewrite+0x123>
801013f3:	8b 45 10             	mov    0x10(%ebp),%eax
801013f6:	eb 14                	jmp    8010140c <filewrite+0x137>
801013f8:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801013fd:	eb 0d                	jmp    8010140c <filewrite+0x137>
  }
  panic("filewrite");
801013ff:	83 ec 0c             	sub    $0xc,%esp
80101402:	68 38 85 10 80       	push   $0x80108538
80101407:	e8 a9 f1 ff ff       	call   801005b5 <panic>
}
8010140c:	8b 5d fc             	mov    -0x4(%ebp),%ebx
8010140f:	c9                   	leave  
80101410:	c3                   	ret    

80101411 <readsb>:
struct superblock sb; 

// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
80101411:	55                   	push   %ebp
80101412:	89 e5                	mov    %esp,%ebp
80101414:	83 ec 18             	sub    $0x18,%esp
  struct buf *bp;

  bp = bread(dev, 1);
80101417:	8b 45 08             	mov    0x8(%ebp),%eax
8010141a:	83 ec 08             	sub    $0x8,%esp
8010141d:	6a 01                	push   $0x1
8010141f:	50                   	push   %eax
80101420:	e8 aa ed ff ff       	call   801001cf <bread>
80101425:	83 c4 10             	add    $0x10,%esp
80101428:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memmove(sb, bp->data, sizeof(*sb));
8010142b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010142e:	83 c0 5c             	add    $0x5c,%eax
80101431:	83 ec 04             	sub    $0x4,%esp
80101434:	6a 1c                	push   $0x1c
80101436:	50                   	push   %eax
80101437:	ff 75 0c             	push   0xc(%ebp)
8010143a:	e8 b0 3e 00 00       	call   801052ef <memmove>
8010143f:	83 c4 10             	add    $0x10,%esp
  brelse(bp);
80101442:	83 ec 0c             	sub    $0xc,%esp
80101445:	ff 75 f4             	push   -0xc(%ebp)
80101448:	e8 04 ee ff ff       	call   80100251 <brelse>
8010144d:	83 c4 10             	add    $0x10,%esp
}
80101450:	90                   	nop
80101451:	c9                   	leave  
80101452:	c3                   	ret    

80101453 <bzero>:

// Zero a block.
static void
bzero(int dev, int bno)
{
80101453:	55                   	push   %ebp
80101454:	89 e5                	mov    %esp,%ebp
80101456:	83 ec 18             	sub    $0x18,%esp
  struct buf *bp;

  bp = bread(dev, bno);
80101459:	8b 55 0c             	mov    0xc(%ebp),%edx
8010145c:	8b 45 08             	mov    0x8(%ebp),%eax
8010145f:	83 ec 08             	sub    $0x8,%esp
80101462:	52                   	push   %edx
80101463:	50                   	push   %eax
80101464:	e8 66 ed ff ff       	call   801001cf <bread>
80101469:	83 c4 10             	add    $0x10,%esp
8010146c:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memset(bp->data, 0, BSIZE);
8010146f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101472:	83 c0 5c             	add    $0x5c,%eax
80101475:	83 ec 04             	sub    $0x4,%esp
80101478:	68 00 02 00 00       	push   $0x200
8010147d:	6a 00                	push   $0x0
8010147f:	50                   	push   %eax
80101480:	e8 ab 3d 00 00       	call   80105230 <memset>
80101485:	83 c4 10             	add    $0x10,%esp
  log_write(bp);
80101488:	83 ec 0c             	sub    $0xc,%esp
8010148b:	ff 75 f4             	push   -0xc(%ebp)
8010148e:	e8 05 23 00 00       	call   80103798 <log_write>
80101493:	83 c4 10             	add    $0x10,%esp
  brelse(bp);
80101496:	83 ec 0c             	sub    $0xc,%esp
80101499:	ff 75 f4             	push   -0xc(%ebp)
8010149c:	e8 b0 ed ff ff       	call   80100251 <brelse>
801014a1:	83 c4 10             	add    $0x10,%esp
}
801014a4:	90                   	nop
801014a5:	c9                   	leave  
801014a6:	c3                   	ret    

801014a7 <balloc>:
// Blocks.

// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
801014a7:	55                   	push   %ebp
801014a8:	89 e5                	mov    %esp,%ebp
801014aa:	83 ec 18             	sub    $0x18,%esp
  int b, bi, m;
  struct buf *bp;

  bp = 0;
801014ad:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
  for(b = 0; b < sb.size; b += BPB){
801014b4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801014bb:	e9 0b 01 00 00       	jmp    801015cb <balloc+0x124>
    bp = bread(dev, BBLOCK(b, sb));
801014c0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801014c3:	8d 90 ff 0f 00 00    	lea    0xfff(%eax),%edx
801014c9:	85 c0                	test   %eax,%eax
801014cb:	0f 48 c2             	cmovs  %edx,%eax
801014ce:	c1 f8 0c             	sar    $0xc,%eax
801014d1:	89 c2                	mov    %eax,%edx
801014d3:	a1 d8 09 11 80       	mov    0x801109d8,%eax
801014d8:	01 d0                	add    %edx,%eax
801014da:	83 ec 08             	sub    $0x8,%esp
801014dd:	50                   	push   %eax
801014de:	ff 75 08             	push   0x8(%ebp)
801014e1:	e8 e9 ec ff ff       	call   801001cf <bread>
801014e6:	83 c4 10             	add    $0x10,%esp
801014e9:	89 45 ec             	mov    %eax,-0x14(%ebp)
    for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801014ec:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
801014f3:	e9 9e 00 00 00       	jmp    80101596 <balloc+0xef>
      m = 1 << (bi % 8);
801014f8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801014fb:	83 e0 07             	and    $0x7,%eax
801014fe:	ba 01 00 00 00       	mov    $0x1,%edx
80101503:	89 c1                	mov    %eax,%ecx
80101505:	d3 e2                	shl    %cl,%edx
80101507:	89 d0                	mov    %edx,%eax
80101509:	89 45 e8             	mov    %eax,-0x18(%ebp)
      if((bp->data[bi/8] & m) == 0){  // Is block free?
8010150c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010150f:	8d 50 07             	lea    0x7(%eax),%edx
80101512:	85 c0                	test   %eax,%eax
80101514:	0f 48 c2             	cmovs  %edx,%eax
80101517:	c1 f8 03             	sar    $0x3,%eax
8010151a:	89 c2                	mov    %eax,%edx
8010151c:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010151f:	0f b6 44 10 5c       	movzbl 0x5c(%eax,%edx,1),%eax
80101524:	0f b6 c0             	movzbl %al,%eax
80101527:	23 45 e8             	and    -0x18(%ebp),%eax
8010152a:	85 c0                	test   %eax,%eax
8010152c:	75 64                	jne    80101592 <balloc+0xeb>
        bp->data[bi/8] |= m;  // Mark block in use.
8010152e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101531:	8d 50 07             	lea    0x7(%eax),%edx
80101534:	85 c0                	test   %eax,%eax
80101536:	0f 48 c2             	cmovs  %edx,%eax
80101539:	c1 f8 03             	sar    $0x3,%eax
8010153c:	8b 55 ec             	mov    -0x14(%ebp),%edx
8010153f:	0f b6 54 02 5c       	movzbl 0x5c(%edx,%eax,1),%edx
80101544:	89 d1                	mov    %edx,%ecx
80101546:	8b 55 e8             	mov    -0x18(%ebp),%edx
80101549:	09 ca                	or     %ecx,%edx
8010154b:	89 d1                	mov    %edx,%ecx
8010154d:	8b 55 ec             	mov    -0x14(%ebp),%edx
80101550:	88 4c 02 5c          	mov    %cl,0x5c(%edx,%eax,1)
        log_write(bp);
80101554:	83 ec 0c             	sub    $0xc,%esp
80101557:	ff 75 ec             	push   -0x14(%ebp)
8010155a:	e8 39 22 00 00       	call   80103798 <log_write>
8010155f:	83 c4 10             	add    $0x10,%esp
        brelse(bp);
80101562:	83 ec 0c             	sub    $0xc,%esp
80101565:	ff 75 ec             	push   -0x14(%ebp)
80101568:	e8 e4 ec ff ff       	call   80100251 <brelse>
8010156d:	83 c4 10             	add    $0x10,%esp
        bzero(dev, b + bi);
80101570:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101573:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101576:	01 c2                	add    %eax,%edx
80101578:	8b 45 08             	mov    0x8(%ebp),%eax
8010157b:	83 ec 08             	sub    $0x8,%esp
8010157e:	52                   	push   %edx
8010157f:	50                   	push   %eax
80101580:	e8 ce fe ff ff       	call   80101453 <bzero>
80101585:	83 c4 10             	add    $0x10,%esp
        return b + bi;
80101588:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010158b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010158e:	01 d0                	add    %edx,%eax
80101590:	eb 57                	jmp    801015e9 <balloc+0x142>
    for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80101592:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
80101596:	81 7d f0 ff 0f 00 00 	cmpl   $0xfff,-0x10(%ebp)
8010159d:	7f 17                	jg     801015b6 <balloc+0x10f>
8010159f:	8b 55 f4             	mov    -0xc(%ebp),%edx
801015a2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801015a5:	01 d0                	add    %edx,%eax
801015a7:	89 c2                	mov    %eax,%edx
801015a9:	a1 c0 09 11 80       	mov    0x801109c0,%eax
801015ae:	39 c2                	cmp    %eax,%edx
801015b0:	0f 82 42 ff ff ff    	jb     801014f8 <balloc+0x51>
      }
    }
    brelse(bp);
801015b6:	83 ec 0c             	sub    $0xc,%esp
801015b9:	ff 75 ec             	push   -0x14(%ebp)
801015bc:	e8 90 ec ff ff       	call   80100251 <brelse>
801015c1:	83 c4 10             	add    $0x10,%esp
  for(b = 0; b < sb.size; b += BPB){
801015c4:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801015cb:	8b 15 c0 09 11 80    	mov    0x801109c0,%edx
801015d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801015d4:	39 c2                	cmp    %eax,%edx
801015d6:	0f 87 e4 fe ff ff    	ja     801014c0 <balloc+0x19>
  }
  panic("balloc: out of blocks");
801015dc:	83 ec 0c             	sub    $0xc,%esp
801015df:	68 44 85 10 80       	push   $0x80108544
801015e4:	e8 cc ef ff ff       	call   801005b5 <panic>
}
801015e9:	c9                   	leave  
801015ea:	c3                   	ret    

801015eb <bfree>:

// Free a disk block.
static void
bfree(int dev, uint b)
{
801015eb:	55                   	push   %ebp
801015ec:	89 e5                	mov    %esp,%ebp
801015ee:	83 ec 18             	sub    $0x18,%esp
  struct buf *bp;
  int bi, m;

  readsb(dev, &sb);
801015f1:	83 ec 08             	sub    $0x8,%esp
801015f4:	68 c0 09 11 80       	push   $0x801109c0
801015f9:	ff 75 08             	push   0x8(%ebp)
801015fc:	e8 10 fe ff ff       	call   80101411 <readsb>
80101601:	83 c4 10             	add    $0x10,%esp
  bp = bread(dev, BBLOCK(b, sb));
80101604:	8b 45 0c             	mov    0xc(%ebp),%eax
80101607:	c1 e8 0c             	shr    $0xc,%eax
8010160a:	89 c2                	mov    %eax,%edx
8010160c:	a1 d8 09 11 80       	mov    0x801109d8,%eax
80101611:	01 c2                	add    %eax,%edx
80101613:	8b 45 08             	mov    0x8(%ebp),%eax
80101616:	83 ec 08             	sub    $0x8,%esp
80101619:	52                   	push   %edx
8010161a:	50                   	push   %eax
8010161b:	e8 af eb ff ff       	call   801001cf <bread>
80101620:	83 c4 10             	add    $0x10,%esp
80101623:	89 45 f4             	mov    %eax,-0xc(%ebp)
  bi = b % BPB;
80101626:	8b 45 0c             	mov    0xc(%ebp),%eax
80101629:	25 ff 0f 00 00       	and    $0xfff,%eax
8010162e:	89 45 f0             	mov    %eax,-0x10(%ebp)
  m = 1 << (bi % 8);
80101631:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101634:	83 e0 07             	and    $0x7,%eax
80101637:	ba 01 00 00 00       	mov    $0x1,%edx
8010163c:	89 c1                	mov    %eax,%ecx
8010163e:	d3 e2                	shl    %cl,%edx
80101640:	89 d0                	mov    %edx,%eax
80101642:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if((bp->data[bi/8] & m) == 0)
80101645:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101648:	8d 50 07             	lea    0x7(%eax),%edx
8010164b:	85 c0                	test   %eax,%eax
8010164d:	0f 48 c2             	cmovs  %edx,%eax
80101650:	c1 f8 03             	sar    $0x3,%eax
80101653:	89 c2                	mov    %eax,%edx
80101655:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101658:	0f b6 44 10 5c       	movzbl 0x5c(%eax,%edx,1),%eax
8010165d:	0f b6 c0             	movzbl %al,%eax
80101660:	23 45 ec             	and    -0x14(%ebp),%eax
80101663:	85 c0                	test   %eax,%eax
80101665:	75 0d                	jne    80101674 <bfree+0x89>
    panic("freeing free block");
80101667:	83 ec 0c             	sub    $0xc,%esp
8010166a:	68 5a 85 10 80       	push   $0x8010855a
8010166f:	e8 41 ef ff ff       	call   801005b5 <panic>
  bp->data[bi/8] &= ~m;
80101674:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101677:	8d 50 07             	lea    0x7(%eax),%edx
8010167a:	85 c0                	test   %eax,%eax
8010167c:	0f 48 c2             	cmovs  %edx,%eax
8010167f:	c1 f8 03             	sar    $0x3,%eax
80101682:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101685:	0f b6 54 02 5c       	movzbl 0x5c(%edx,%eax,1),%edx
8010168a:	89 d1                	mov    %edx,%ecx
8010168c:	8b 55 ec             	mov    -0x14(%ebp),%edx
8010168f:	f7 d2                	not    %edx
80101691:	21 ca                	and    %ecx,%edx
80101693:	89 d1                	mov    %edx,%ecx
80101695:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101698:	88 4c 02 5c          	mov    %cl,0x5c(%edx,%eax,1)
  log_write(bp);
8010169c:	83 ec 0c             	sub    $0xc,%esp
8010169f:	ff 75 f4             	push   -0xc(%ebp)
801016a2:	e8 f1 20 00 00       	call   80103798 <log_write>
801016a7:	83 c4 10             	add    $0x10,%esp
  brelse(bp);
801016aa:	83 ec 0c             	sub    $0xc,%esp
801016ad:	ff 75 f4             	push   -0xc(%ebp)
801016b0:	e8 9c eb ff ff       	call   80100251 <brelse>
801016b5:	83 c4 10             	add    $0x10,%esp
}
801016b8:	90                   	nop
801016b9:	c9                   	leave  
801016ba:	c3                   	ret    

801016bb <iinit>:
  struct inode inode[NINODE];
} icache;

void
iinit(int dev)
{
801016bb:	55                   	push   %ebp
801016bc:	89 e5                	mov    %esp,%ebp
801016be:	57                   	push   %edi
801016bf:	56                   	push   %esi
801016c0:	53                   	push   %ebx
801016c1:	83 ec 2c             	sub    $0x2c,%esp
  int i = 0;
801016c4:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  
  initlock(&icache.lock, "icache");
801016cb:	83 ec 08             	sub    $0x8,%esp
801016ce:	68 6d 85 10 80       	push   $0x8010856d
801016d3:	68 e0 09 11 80       	push   $0x801109e0
801016d8:	e8 bb 38 00 00       	call   80104f98 <initlock>
801016dd:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i < NINODE; i++) {
801016e0:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
801016e7:	eb 2d                	jmp    80101716 <iinit+0x5b>
    initsleeplock(&icache.inode[i].lock, "inode");
801016e9:	8b 55 e4             	mov    -0x1c(%ebp),%edx
801016ec:	89 d0                	mov    %edx,%eax
801016ee:	c1 e0 03             	shl    $0x3,%eax
801016f1:	01 d0                	add    %edx,%eax
801016f3:	c1 e0 04             	shl    $0x4,%eax
801016f6:	83 c0 30             	add    $0x30,%eax
801016f9:	05 e0 09 11 80       	add    $0x801109e0,%eax
801016fe:	83 c0 10             	add    $0x10,%eax
80101701:	83 ec 08             	sub    $0x8,%esp
80101704:	68 74 85 10 80       	push   $0x80108574
80101709:	50                   	push   %eax
8010170a:	e8 2c 37 00 00       	call   80104e3b <initsleeplock>
8010170f:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i < NINODE; i++) {
80101712:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
80101716:	83 7d e4 31          	cmpl   $0x31,-0x1c(%ebp)
8010171a:	7e cd                	jle    801016e9 <iinit+0x2e>
  }

  readsb(dev, &sb);
8010171c:	83 ec 08             	sub    $0x8,%esp
8010171f:	68 c0 09 11 80       	push   $0x801109c0
80101724:	ff 75 08             	push   0x8(%ebp)
80101727:	e8 e5 fc ff ff       	call   80101411 <readsb>
8010172c:	83 c4 10             	add    $0x10,%esp
  cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\
8010172f:	a1 d8 09 11 80       	mov    0x801109d8,%eax
80101734:	89 45 d4             	mov    %eax,-0x2c(%ebp)
80101737:	8b 3d d4 09 11 80    	mov    0x801109d4,%edi
8010173d:	8b 35 d0 09 11 80    	mov    0x801109d0,%esi
80101743:	8b 1d cc 09 11 80    	mov    0x801109cc,%ebx
80101749:	8b 0d c8 09 11 80    	mov    0x801109c8,%ecx
8010174f:	8b 15 c4 09 11 80    	mov    0x801109c4,%edx
80101755:	a1 c0 09 11 80       	mov    0x801109c0,%eax
8010175a:	ff 75 d4             	push   -0x2c(%ebp)
8010175d:	57                   	push   %edi
8010175e:	56                   	push   %esi
8010175f:	53                   	push   %ebx
80101760:	51                   	push   %ecx
80101761:	52                   	push   %edx
80101762:	50                   	push   %eax
80101763:	68 7c 85 10 80       	push   $0x8010857c
80101768:	e8 93 ec ff ff       	call   80100400 <cprintf>
8010176d:	83 c4 20             	add    $0x20,%esp
 inodestart %d bmap start %d\n", sb.size, sb.nblocks,
          sb.ninodes, sb.nlog, sb.logstart, sb.inodestart,
          sb.bmapstart);
}
80101770:	90                   	nop
80101771:	8d 65 f4             	lea    -0xc(%ebp),%esp
80101774:	5b                   	pop    %ebx
80101775:	5e                   	pop    %esi
80101776:	5f                   	pop    %edi
80101777:	5d                   	pop    %ebp
80101778:	c3                   	ret    

80101779 <ialloc>:
// Allocate an inode on device dev.
// Mark it as allocated by  giving it type type.
// Returns an unlocked but allocated and referenced inode.
struct inode*
ialloc(uint dev, short type)
{
80101779:	55                   	push   %ebp
8010177a:	89 e5                	mov    %esp,%ebp
8010177c:	83 ec 28             	sub    $0x28,%esp
8010177f:	8b 45 0c             	mov    0xc(%ebp),%eax
80101782:	66 89 45 e4          	mov    %ax,-0x1c(%ebp)
  int inum;
  struct buf *bp;
  struct dinode *dip;

  for(inum = 1; inum < sb.ninodes; inum++){
80101786:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
8010178d:	e9 9e 00 00 00       	jmp    80101830 <ialloc+0xb7>
    bp = bread(dev, IBLOCK(inum, sb));
80101792:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101795:	c1 e8 03             	shr    $0x3,%eax
80101798:	89 c2                	mov    %eax,%edx
8010179a:	a1 d4 09 11 80       	mov    0x801109d4,%eax
8010179f:	01 d0                	add    %edx,%eax
801017a1:	83 ec 08             	sub    $0x8,%esp
801017a4:	50                   	push   %eax
801017a5:	ff 75 08             	push   0x8(%ebp)
801017a8:	e8 22 ea ff ff       	call   801001cf <bread>
801017ad:	83 c4 10             	add    $0x10,%esp
801017b0:	89 45 f0             	mov    %eax,-0x10(%ebp)
    dip = (struct dinode*)bp->data + inum%IPB;
801017b3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801017b6:	8d 50 5c             	lea    0x5c(%eax),%edx
801017b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017bc:	83 e0 07             	and    $0x7,%eax
801017bf:	c1 e0 06             	shl    $0x6,%eax
801017c2:	01 d0                	add    %edx,%eax
801017c4:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if(dip->type == 0){  // a free inode
801017c7:	8b 45 ec             	mov    -0x14(%ebp),%eax
801017ca:	0f b7 00             	movzwl (%eax),%eax
801017cd:	66 85 c0             	test   %ax,%ax
801017d0:	75 4c                	jne    8010181e <ialloc+0xa5>
      memset(dip, 0, sizeof(*dip));
801017d2:	83 ec 04             	sub    $0x4,%esp
801017d5:	6a 40                	push   $0x40
801017d7:	6a 00                	push   $0x0
801017d9:	ff 75 ec             	push   -0x14(%ebp)
801017dc:	e8 4f 3a 00 00       	call   80105230 <memset>
801017e1:	83 c4 10             	add    $0x10,%esp
      dip->type = type;
801017e4:	8b 45 ec             	mov    -0x14(%ebp),%eax
801017e7:	0f b7 55 e4          	movzwl -0x1c(%ebp),%edx
801017eb:	66 89 10             	mov    %dx,(%eax)
      log_write(bp);   // mark it allocated on the disk
801017ee:	83 ec 0c             	sub    $0xc,%esp
801017f1:	ff 75 f0             	push   -0x10(%ebp)
801017f4:	e8 9f 1f 00 00       	call   80103798 <log_write>
801017f9:	83 c4 10             	add    $0x10,%esp
      brelse(bp);
801017fc:	83 ec 0c             	sub    $0xc,%esp
801017ff:	ff 75 f0             	push   -0x10(%ebp)
80101802:	e8 4a ea ff ff       	call   80100251 <brelse>
80101807:	83 c4 10             	add    $0x10,%esp
      return iget(dev, inum);
8010180a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010180d:	83 ec 08             	sub    $0x8,%esp
80101810:	50                   	push   %eax
80101811:	ff 75 08             	push   0x8(%ebp)
80101814:	e8 f8 00 00 00       	call   80101911 <iget>
80101819:	83 c4 10             	add    $0x10,%esp
8010181c:	eb 30                	jmp    8010184e <ialloc+0xd5>
    }
    brelse(bp);
8010181e:	83 ec 0c             	sub    $0xc,%esp
80101821:	ff 75 f0             	push   -0x10(%ebp)
80101824:	e8 28 ea ff ff       	call   80100251 <brelse>
80101829:	83 c4 10             	add    $0x10,%esp
  for(inum = 1; inum < sb.ninodes; inum++){
8010182c:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80101830:	8b 15 c8 09 11 80    	mov    0x801109c8,%edx
80101836:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101839:	39 c2                	cmp    %eax,%edx
8010183b:	0f 87 51 ff ff ff    	ja     80101792 <ialloc+0x19>
  }
  panic("ialloc: no inodes");
80101841:	83 ec 0c             	sub    $0xc,%esp
80101844:	68 cf 85 10 80       	push   $0x801085cf
80101849:	e8 67 ed ff ff       	call   801005b5 <panic>
}
8010184e:	c9                   	leave  
8010184f:	c3                   	ret    

80101850 <iupdate>:
// Must be called after every change to an ip->xxx field
// that lives on disk, since i-node cache is write-through.
// Caller must hold ip->lock.
void
iupdate(struct inode *ip)
{
80101850:	55                   	push   %ebp
80101851:	89 e5                	mov    %esp,%ebp
80101853:	83 ec 18             	sub    $0x18,%esp
  struct buf *bp;
  struct dinode *dip;

  bp = bread(ip->dev, IBLOCK(ip->inum, sb));
80101856:	8b 45 08             	mov    0x8(%ebp),%eax
80101859:	8b 40 04             	mov    0x4(%eax),%eax
8010185c:	c1 e8 03             	shr    $0x3,%eax
8010185f:	89 c2                	mov    %eax,%edx
80101861:	a1 d4 09 11 80       	mov    0x801109d4,%eax
80101866:	01 c2                	add    %eax,%edx
80101868:	8b 45 08             	mov    0x8(%ebp),%eax
8010186b:	8b 00                	mov    (%eax),%eax
8010186d:	83 ec 08             	sub    $0x8,%esp
80101870:	52                   	push   %edx
80101871:	50                   	push   %eax
80101872:	e8 58 e9 ff ff       	call   801001cf <bread>
80101877:	83 c4 10             	add    $0x10,%esp
8010187a:	89 45 f4             	mov    %eax,-0xc(%ebp)
  dip = (struct dinode*)bp->data + ip->inum%IPB;
8010187d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101880:	8d 50 5c             	lea    0x5c(%eax),%edx
80101883:	8b 45 08             	mov    0x8(%ebp),%eax
80101886:	8b 40 04             	mov    0x4(%eax),%eax
80101889:	83 e0 07             	and    $0x7,%eax
8010188c:	c1 e0 06             	shl    $0x6,%eax
8010188f:	01 d0                	add    %edx,%eax
80101891:	89 45 f0             	mov    %eax,-0x10(%ebp)
  dip->type = ip->type;
80101894:	8b 45 08             	mov    0x8(%ebp),%eax
80101897:	0f b7 50 50          	movzwl 0x50(%eax),%edx
8010189b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010189e:	66 89 10             	mov    %dx,(%eax)
  dip->major = ip->major;
801018a1:	8b 45 08             	mov    0x8(%ebp),%eax
801018a4:	0f b7 50 52          	movzwl 0x52(%eax),%edx
801018a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801018ab:	66 89 50 02          	mov    %dx,0x2(%eax)
  dip->minor = ip->minor;
801018af:	8b 45 08             	mov    0x8(%ebp),%eax
801018b2:	0f b7 50 54          	movzwl 0x54(%eax),%edx
801018b6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801018b9:	66 89 50 04          	mov    %dx,0x4(%eax)
  dip->nlink = ip->nlink;
801018bd:	8b 45 08             	mov    0x8(%ebp),%eax
801018c0:	0f b7 50 56          	movzwl 0x56(%eax),%edx
801018c4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801018c7:	66 89 50 06          	mov    %dx,0x6(%eax)
  dip->size = ip->size;
801018cb:	8b 45 08             	mov    0x8(%ebp),%eax
801018ce:	8b 50 58             	mov    0x58(%eax),%edx
801018d1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801018d4:	89 50 08             	mov    %edx,0x8(%eax)
  memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
801018d7:	8b 45 08             	mov    0x8(%ebp),%eax
801018da:	8d 50 5c             	lea    0x5c(%eax),%edx
801018dd:	8b 45 f0             	mov    -0x10(%ebp),%eax
801018e0:	83 c0 0c             	add    $0xc,%eax
801018e3:	83 ec 04             	sub    $0x4,%esp
801018e6:	6a 34                	push   $0x34
801018e8:	52                   	push   %edx
801018e9:	50                   	push   %eax
801018ea:	e8 00 3a 00 00       	call   801052ef <memmove>
801018ef:	83 c4 10             	add    $0x10,%esp
  log_write(bp);
801018f2:	83 ec 0c             	sub    $0xc,%esp
801018f5:	ff 75 f4             	push   -0xc(%ebp)
801018f8:	e8 9b 1e 00 00       	call   80103798 <log_write>
801018fd:	83 c4 10             	add    $0x10,%esp
  brelse(bp);
80101900:	83 ec 0c             	sub    $0xc,%esp
80101903:	ff 75 f4             	push   -0xc(%ebp)
80101906:	e8 46 e9 ff ff       	call   80100251 <brelse>
8010190b:	83 c4 10             	add    $0x10,%esp
}
8010190e:	90                   	nop
8010190f:	c9                   	leave  
80101910:	c3                   	ret    

80101911 <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101911:	55                   	push   %ebp
80101912:	89 e5                	mov    %esp,%ebp
80101914:	83 ec 18             	sub    $0x18,%esp
  struct inode *ip, *empty;

  acquire(&icache.lock);
80101917:	83 ec 0c             	sub    $0xc,%esp
8010191a:	68 e0 09 11 80       	push   $0x801109e0
8010191f:	e8 96 36 00 00       	call   80104fba <acquire>
80101924:	83 c4 10             	add    $0x10,%esp

  // Is the inode already cached?
  empty = 0;
80101927:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010192e:	c7 45 f4 14 0a 11 80 	movl   $0x80110a14,-0xc(%ebp)
80101935:	eb 60                	jmp    80101997 <iget+0x86>
    if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
80101937:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010193a:	8b 40 08             	mov    0x8(%eax),%eax
8010193d:	85 c0                	test   %eax,%eax
8010193f:	7e 39                	jle    8010197a <iget+0x69>
80101941:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101944:	8b 00                	mov    (%eax),%eax
80101946:	39 45 08             	cmp    %eax,0x8(%ebp)
80101949:	75 2f                	jne    8010197a <iget+0x69>
8010194b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010194e:	8b 40 04             	mov    0x4(%eax),%eax
80101951:	39 45 0c             	cmp    %eax,0xc(%ebp)
80101954:	75 24                	jne    8010197a <iget+0x69>
      ip->ref++;
80101956:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101959:	8b 40 08             	mov    0x8(%eax),%eax
8010195c:	8d 50 01             	lea    0x1(%eax),%edx
8010195f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101962:	89 50 08             	mov    %edx,0x8(%eax)
      release(&icache.lock);
80101965:	83 ec 0c             	sub    $0xc,%esp
80101968:	68 e0 09 11 80       	push   $0x801109e0
8010196d:	e8 b6 36 00 00       	call   80105028 <release>
80101972:	83 c4 10             	add    $0x10,%esp
      return ip;
80101975:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101978:	eb 77                	jmp    801019f1 <iget+0xe0>
    }
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
8010197a:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010197e:	75 10                	jne    80101990 <iget+0x7f>
80101980:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101983:	8b 40 08             	mov    0x8(%eax),%eax
80101986:	85 c0                	test   %eax,%eax
80101988:	75 06                	jne    80101990 <iget+0x7f>
      empty = ip;
8010198a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010198d:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
80101990:	81 45 f4 90 00 00 00 	addl   $0x90,-0xc(%ebp)
80101997:	81 7d f4 34 26 11 80 	cmpl   $0x80112634,-0xc(%ebp)
8010199e:	72 97                	jb     80101937 <iget+0x26>
  }

  // Recycle an inode cache entry.
  if(empty == 0)
801019a0:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801019a4:	75 0d                	jne    801019b3 <iget+0xa2>
    panic("iget: no inodes");
801019a6:	83 ec 0c             	sub    $0xc,%esp
801019a9:	68 e1 85 10 80       	push   $0x801085e1
801019ae:	e8 02 ec ff ff       	call   801005b5 <panic>

  ip = empty;
801019b3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801019b6:	89 45 f4             	mov    %eax,-0xc(%ebp)
  ip->dev = dev;
801019b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801019bc:	8b 55 08             	mov    0x8(%ebp),%edx
801019bf:	89 10                	mov    %edx,(%eax)
  ip->inum = inum;
801019c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801019c4:	8b 55 0c             	mov    0xc(%ebp),%edx
801019c7:	89 50 04             	mov    %edx,0x4(%eax)
  ip->ref = 1;
801019ca:	8b 45 f4             	mov    -0xc(%ebp),%eax
801019cd:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
  ip->valid = 0;
801019d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801019d7:	c7 40 4c 00 00 00 00 	movl   $0x0,0x4c(%eax)
  release(&icache.lock);
801019de:	83 ec 0c             	sub    $0xc,%esp
801019e1:	68 e0 09 11 80       	push   $0x801109e0
801019e6:	e8 3d 36 00 00       	call   80105028 <release>
801019eb:	83 c4 10             	add    $0x10,%esp

  return ip;
801019ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
801019f1:	c9                   	leave  
801019f2:	c3                   	ret    

801019f3 <idup>:

// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
801019f3:	55                   	push   %ebp
801019f4:	89 e5                	mov    %esp,%ebp
801019f6:	83 ec 08             	sub    $0x8,%esp
  acquire(&icache.lock);
801019f9:	83 ec 0c             	sub    $0xc,%esp
801019fc:	68 e0 09 11 80       	push   $0x801109e0
80101a01:	e8 b4 35 00 00       	call   80104fba <acquire>
80101a06:	83 c4 10             	add    $0x10,%esp
  ip->ref++;
80101a09:	8b 45 08             	mov    0x8(%ebp),%eax
80101a0c:	8b 40 08             	mov    0x8(%eax),%eax
80101a0f:	8d 50 01             	lea    0x1(%eax),%edx
80101a12:	8b 45 08             	mov    0x8(%ebp),%eax
80101a15:	89 50 08             	mov    %edx,0x8(%eax)
  release(&icache.lock);
80101a18:	83 ec 0c             	sub    $0xc,%esp
80101a1b:	68 e0 09 11 80       	push   $0x801109e0
80101a20:	e8 03 36 00 00       	call   80105028 <release>
80101a25:	83 c4 10             	add    $0x10,%esp
  return ip;
80101a28:	8b 45 08             	mov    0x8(%ebp),%eax
}
80101a2b:	c9                   	leave  
80101a2c:	c3                   	ret    

80101a2d <ilock>:

// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
80101a2d:	55                   	push   %ebp
80101a2e:	89 e5                	mov    %esp,%ebp
80101a30:	83 ec 18             	sub    $0x18,%esp
  struct buf *bp;
  struct dinode *dip;

  if(ip == 0 || ip->ref < 1)
80101a33:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80101a37:	74 0a                	je     80101a43 <ilock+0x16>
80101a39:	8b 45 08             	mov    0x8(%ebp),%eax
80101a3c:	8b 40 08             	mov    0x8(%eax),%eax
80101a3f:	85 c0                	test   %eax,%eax
80101a41:	7f 0d                	jg     80101a50 <ilock+0x23>
    panic("ilock");
80101a43:	83 ec 0c             	sub    $0xc,%esp
80101a46:	68 f1 85 10 80       	push   $0x801085f1
80101a4b:	e8 65 eb ff ff       	call   801005b5 <panic>

  acquiresleep(&ip->lock);
80101a50:	8b 45 08             	mov    0x8(%ebp),%eax
80101a53:	83 c0 0c             	add    $0xc,%eax
80101a56:	83 ec 0c             	sub    $0xc,%esp
80101a59:	50                   	push   %eax
80101a5a:	e8 18 34 00 00       	call   80104e77 <acquiresleep>
80101a5f:	83 c4 10             	add    $0x10,%esp

  if(ip->valid == 0){
80101a62:	8b 45 08             	mov    0x8(%ebp),%eax
80101a65:	8b 40 4c             	mov    0x4c(%eax),%eax
80101a68:	85 c0                	test   %eax,%eax
80101a6a:	0f 85 cd 00 00 00    	jne    80101b3d <ilock+0x110>
    bp = bread(ip->dev, IBLOCK(ip->inum, sb));
80101a70:	8b 45 08             	mov    0x8(%ebp),%eax
80101a73:	8b 40 04             	mov    0x4(%eax),%eax
80101a76:	c1 e8 03             	shr    $0x3,%eax
80101a79:	89 c2                	mov    %eax,%edx
80101a7b:	a1 d4 09 11 80       	mov    0x801109d4,%eax
80101a80:	01 c2                	add    %eax,%edx
80101a82:	8b 45 08             	mov    0x8(%ebp),%eax
80101a85:	8b 00                	mov    (%eax),%eax
80101a87:	83 ec 08             	sub    $0x8,%esp
80101a8a:	52                   	push   %edx
80101a8b:	50                   	push   %eax
80101a8c:	e8 3e e7 ff ff       	call   801001cf <bread>
80101a91:	83 c4 10             	add    $0x10,%esp
80101a94:	89 45 f4             	mov    %eax,-0xc(%ebp)
    dip = (struct dinode*)bp->data + ip->inum%IPB;
80101a97:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101a9a:	8d 50 5c             	lea    0x5c(%eax),%edx
80101a9d:	8b 45 08             	mov    0x8(%ebp),%eax
80101aa0:	8b 40 04             	mov    0x4(%eax),%eax
80101aa3:	83 e0 07             	and    $0x7,%eax
80101aa6:	c1 e0 06             	shl    $0x6,%eax
80101aa9:	01 d0                	add    %edx,%eax
80101aab:	89 45 f0             	mov    %eax,-0x10(%ebp)
    ip->type = dip->type;
80101aae:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101ab1:	0f b7 10             	movzwl (%eax),%edx
80101ab4:	8b 45 08             	mov    0x8(%ebp),%eax
80101ab7:	66 89 50 50          	mov    %dx,0x50(%eax)
    ip->major = dip->major;
80101abb:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101abe:	0f b7 50 02          	movzwl 0x2(%eax),%edx
80101ac2:	8b 45 08             	mov    0x8(%ebp),%eax
80101ac5:	66 89 50 52          	mov    %dx,0x52(%eax)
    ip->minor = dip->minor;
80101ac9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101acc:	0f b7 50 04          	movzwl 0x4(%eax),%edx
80101ad0:	8b 45 08             	mov    0x8(%ebp),%eax
80101ad3:	66 89 50 54          	mov    %dx,0x54(%eax)
    ip->nlink = dip->nlink;
80101ad7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101ada:	0f b7 50 06          	movzwl 0x6(%eax),%edx
80101ade:	8b 45 08             	mov    0x8(%ebp),%eax
80101ae1:	66 89 50 56          	mov    %dx,0x56(%eax)
    ip->size = dip->size;
80101ae5:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101ae8:	8b 50 08             	mov    0x8(%eax),%edx
80101aeb:	8b 45 08             	mov    0x8(%ebp),%eax
80101aee:	89 50 58             	mov    %edx,0x58(%eax)
    memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101af1:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101af4:	8d 50 0c             	lea    0xc(%eax),%edx
80101af7:	8b 45 08             	mov    0x8(%ebp),%eax
80101afa:	83 c0 5c             	add    $0x5c,%eax
80101afd:	83 ec 04             	sub    $0x4,%esp
80101b00:	6a 34                	push   $0x34
80101b02:	52                   	push   %edx
80101b03:	50                   	push   %eax
80101b04:	e8 e6 37 00 00       	call   801052ef <memmove>
80101b09:	83 c4 10             	add    $0x10,%esp
    brelse(bp);
80101b0c:	83 ec 0c             	sub    $0xc,%esp
80101b0f:	ff 75 f4             	push   -0xc(%ebp)
80101b12:	e8 3a e7 ff ff       	call   80100251 <brelse>
80101b17:	83 c4 10             	add    $0x10,%esp
    ip->valid = 1;
80101b1a:	8b 45 08             	mov    0x8(%ebp),%eax
80101b1d:	c7 40 4c 01 00 00 00 	movl   $0x1,0x4c(%eax)
    if(ip->type == 0)
80101b24:	8b 45 08             	mov    0x8(%ebp),%eax
80101b27:	0f b7 40 50          	movzwl 0x50(%eax),%eax
80101b2b:	66 85 c0             	test   %ax,%ax
80101b2e:	75 0d                	jne    80101b3d <ilock+0x110>
      panic("ilock: no type");
80101b30:	83 ec 0c             	sub    $0xc,%esp
80101b33:	68 f7 85 10 80       	push   $0x801085f7
80101b38:	e8 78 ea ff ff       	call   801005b5 <panic>
  }
}
80101b3d:	90                   	nop
80101b3e:	c9                   	leave  
80101b3f:	c3                   	ret    

80101b40 <iunlock>:

// Unlock the given inode.
void
iunlock(struct inode *ip)
{
80101b40:	55                   	push   %ebp
80101b41:	89 e5                	mov    %esp,%ebp
80101b43:	83 ec 08             	sub    $0x8,%esp
  if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
80101b46:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80101b4a:	74 20                	je     80101b6c <iunlock+0x2c>
80101b4c:	8b 45 08             	mov    0x8(%ebp),%eax
80101b4f:	83 c0 0c             	add    $0xc,%eax
80101b52:	83 ec 0c             	sub    $0xc,%esp
80101b55:	50                   	push   %eax
80101b56:	e8 ce 33 00 00       	call   80104f29 <holdingsleep>
80101b5b:	83 c4 10             	add    $0x10,%esp
80101b5e:	85 c0                	test   %eax,%eax
80101b60:	74 0a                	je     80101b6c <iunlock+0x2c>
80101b62:	8b 45 08             	mov    0x8(%ebp),%eax
80101b65:	8b 40 08             	mov    0x8(%eax),%eax
80101b68:	85 c0                	test   %eax,%eax
80101b6a:	7f 0d                	jg     80101b79 <iunlock+0x39>
    panic("iunlock");
80101b6c:	83 ec 0c             	sub    $0xc,%esp
80101b6f:	68 06 86 10 80       	push   $0x80108606
80101b74:	e8 3c ea ff ff       	call   801005b5 <panic>

  releasesleep(&ip->lock);
80101b79:	8b 45 08             	mov    0x8(%ebp),%eax
80101b7c:	83 c0 0c             	add    $0xc,%eax
80101b7f:	83 ec 0c             	sub    $0xc,%esp
80101b82:	50                   	push   %eax
80101b83:	e8 53 33 00 00       	call   80104edb <releasesleep>
80101b88:	83 c4 10             	add    $0x10,%esp
}
80101b8b:	90                   	nop
80101b8c:	c9                   	leave  
80101b8d:	c3                   	ret    

80101b8e <iput>:
// to it, free the inode (and its content) on disk.
// All calls to iput() must be inside a transaction in
// case it has to free the inode.
void
iput(struct inode *ip)
{
80101b8e:	55                   	push   %ebp
80101b8f:	89 e5                	mov    %esp,%ebp
80101b91:	83 ec 18             	sub    $0x18,%esp
  acquiresleep(&ip->lock);
80101b94:	8b 45 08             	mov    0x8(%ebp),%eax
80101b97:	83 c0 0c             	add    $0xc,%eax
80101b9a:	83 ec 0c             	sub    $0xc,%esp
80101b9d:	50                   	push   %eax
80101b9e:	e8 d4 32 00 00       	call   80104e77 <acquiresleep>
80101ba3:	83 c4 10             	add    $0x10,%esp
  if(ip->valid && ip->nlink == 0){
80101ba6:	8b 45 08             	mov    0x8(%ebp),%eax
80101ba9:	8b 40 4c             	mov    0x4c(%eax),%eax
80101bac:	85 c0                	test   %eax,%eax
80101bae:	74 6a                	je     80101c1a <iput+0x8c>
80101bb0:	8b 45 08             	mov    0x8(%ebp),%eax
80101bb3:	0f b7 40 56          	movzwl 0x56(%eax),%eax
80101bb7:	66 85 c0             	test   %ax,%ax
80101bba:	75 5e                	jne    80101c1a <iput+0x8c>
    acquire(&icache.lock);
80101bbc:	83 ec 0c             	sub    $0xc,%esp
80101bbf:	68 e0 09 11 80       	push   $0x801109e0
80101bc4:	e8 f1 33 00 00       	call   80104fba <acquire>
80101bc9:	83 c4 10             	add    $0x10,%esp
    int r = ip->ref;
80101bcc:	8b 45 08             	mov    0x8(%ebp),%eax
80101bcf:	8b 40 08             	mov    0x8(%eax),%eax
80101bd2:	89 45 f4             	mov    %eax,-0xc(%ebp)
    release(&icache.lock);
80101bd5:	83 ec 0c             	sub    $0xc,%esp
80101bd8:	68 e0 09 11 80       	push   $0x801109e0
80101bdd:	e8 46 34 00 00       	call   80105028 <release>
80101be2:	83 c4 10             	add    $0x10,%esp
    if(r == 1){
80101be5:	83 7d f4 01          	cmpl   $0x1,-0xc(%ebp)
80101be9:	75 2f                	jne    80101c1a <iput+0x8c>
      // inode has no links and no other references: truncate and free.
      itrunc(ip);
80101beb:	83 ec 0c             	sub    $0xc,%esp
80101bee:	ff 75 08             	push   0x8(%ebp)
80101bf1:	e8 ad 01 00 00       	call   80101da3 <itrunc>
80101bf6:	83 c4 10             	add    $0x10,%esp
      ip->type = 0;
80101bf9:	8b 45 08             	mov    0x8(%ebp),%eax
80101bfc:	66 c7 40 50 00 00    	movw   $0x0,0x50(%eax)
      iupdate(ip);
80101c02:	83 ec 0c             	sub    $0xc,%esp
80101c05:	ff 75 08             	push   0x8(%ebp)
80101c08:	e8 43 fc ff ff       	call   80101850 <iupdate>
80101c0d:	83 c4 10             	add    $0x10,%esp
      ip->valid = 0;
80101c10:	8b 45 08             	mov    0x8(%ebp),%eax
80101c13:	c7 40 4c 00 00 00 00 	movl   $0x0,0x4c(%eax)
    }
  }
  releasesleep(&ip->lock);
80101c1a:	8b 45 08             	mov    0x8(%ebp),%eax
80101c1d:	83 c0 0c             	add    $0xc,%eax
80101c20:	83 ec 0c             	sub    $0xc,%esp
80101c23:	50                   	push   %eax
80101c24:	e8 b2 32 00 00       	call   80104edb <releasesleep>
80101c29:	83 c4 10             	add    $0x10,%esp

  acquire(&icache.lock);
80101c2c:	83 ec 0c             	sub    $0xc,%esp
80101c2f:	68 e0 09 11 80       	push   $0x801109e0
80101c34:	e8 81 33 00 00       	call   80104fba <acquire>
80101c39:	83 c4 10             	add    $0x10,%esp
  ip->ref--;
80101c3c:	8b 45 08             	mov    0x8(%ebp),%eax
80101c3f:	8b 40 08             	mov    0x8(%eax),%eax
80101c42:	8d 50 ff             	lea    -0x1(%eax),%edx
80101c45:	8b 45 08             	mov    0x8(%ebp),%eax
80101c48:	89 50 08             	mov    %edx,0x8(%eax)
  release(&icache.lock);
80101c4b:	83 ec 0c             	sub    $0xc,%esp
80101c4e:	68 e0 09 11 80       	push   $0x801109e0
80101c53:	e8 d0 33 00 00       	call   80105028 <release>
80101c58:	83 c4 10             	add    $0x10,%esp
}
80101c5b:	90                   	nop
80101c5c:	c9                   	leave  
80101c5d:	c3                   	ret    

80101c5e <iunlockput>:

// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101c5e:	55                   	push   %ebp
80101c5f:	89 e5                	mov    %esp,%ebp
80101c61:	83 ec 08             	sub    $0x8,%esp
  iunlock(ip);
80101c64:	83 ec 0c             	sub    $0xc,%esp
80101c67:	ff 75 08             	push   0x8(%ebp)
80101c6a:	e8 d1 fe ff ff       	call   80101b40 <iunlock>
80101c6f:	83 c4 10             	add    $0x10,%esp
  iput(ip);
80101c72:	83 ec 0c             	sub    $0xc,%esp
80101c75:	ff 75 08             	push   0x8(%ebp)
80101c78:	e8 11 ff ff ff       	call   80101b8e <iput>
80101c7d:	83 c4 10             	add    $0x10,%esp
}
80101c80:	90                   	nop
80101c81:	c9                   	leave  
80101c82:	c3                   	ret    

80101c83 <bmap>:

// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
80101c83:	55                   	push   %ebp
80101c84:	89 e5                	mov    %esp,%ebp
80101c86:	83 ec 18             	sub    $0x18,%esp
  uint addr, *a;
  struct buf *bp;

  if(bn < NDIRECT){
80101c89:	83 7d 0c 0b          	cmpl   $0xb,0xc(%ebp)
80101c8d:	77 42                	ja     80101cd1 <bmap+0x4e>
    if((addr = ip->addrs[bn]) == 0)
80101c8f:	8b 45 08             	mov    0x8(%ebp),%eax
80101c92:	8b 55 0c             	mov    0xc(%ebp),%edx
80101c95:	83 c2 14             	add    $0x14,%edx
80101c98:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101c9c:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101c9f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101ca3:	75 24                	jne    80101cc9 <bmap+0x46>
      ip->addrs[bn] = addr = balloc(ip->dev);
80101ca5:	8b 45 08             	mov    0x8(%ebp),%eax
80101ca8:	8b 00                	mov    (%eax),%eax
80101caa:	83 ec 0c             	sub    $0xc,%esp
80101cad:	50                   	push   %eax
80101cae:	e8 f4 f7 ff ff       	call   801014a7 <balloc>
80101cb3:	83 c4 10             	add    $0x10,%esp
80101cb6:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101cb9:	8b 45 08             	mov    0x8(%ebp),%eax
80101cbc:	8b 55 0c             	mov    0xc(%ebp),%edx
80101cbf:	8d 4a 14             	lea    0x14(%edx),%ecx
80101cc2:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101cc5:	89 54 88 0c          	mov    %edx,0xc(%eax,%ecx,4)
    return addr;
80101cc9:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101ccc:	e9 d0 00 00 00       	jmp    80101da1 <bmap+0x11e>
  }
  bn -= NDIRECT;
80101cd1:	83 6d 0c 0c          	subl   $0xc,0xc(%ebp)

  if(bn < NINDIRECT){
80101cd5:	83 7d 0c 7f          	cmpl   $0x7f,0xc(%ebp)
80101cd9:	0f 87 b5 00 00 00    	ja     80101d94 <bmap+0x111>
    // Load indirect block, allocating if necessary.
    if((addr = ip->addrs[NDIRECT]) == 0)
80101cdf:	8b 45 08             	mov    0x8(%ebp),%eax
80101ce2:	8b 80 8c 00 00 00    	mov    0x8c(%eax),%eax
80101ce8:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101ceb:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101cef:	75 20                	jne    80101d11 <bmap+0x8e>
      ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101cf1:	8b 45 08             	mov    0x8(%ebp),%eax
80101cf4:	8b 00                	mov    (%eax),%eax
80101cf6:	83 ec 0c             	sub    $0xc,%esp
80101cf9:	50                   	push   %eax
80101cfa:	e8 a8 f7 ff ff       	call   801014a7 <balloc>
80101cff:	83 c4 10             	add    $0x10,%esp
80101d02:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101d05:	8b 45 08             	mov    0x8(%ebp),%eax
80101d08:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101d0b:	89 90 8c 00 00 00    	mov    %edx,0x8c(%eax)
    bp = bread(ip->dev, addr);
80101d11:	8b 45 08             	mov    0x8(%ebp),%eax
80101d14:	8b 00                	mov    (%eax),%eax
80101d16:	83 ec 08             	sub    $0x8,%esp
80101d19:	ff 75 f4             	push   -0xc(%ebp)
80101d1c:	50                   	push   %eax
80101d1d:	e8 ad e4 ff ff       	call   801001cf <bread>
80101d22:	83 c4 10             	add    $0x10,%esp
80101d25:	89 45 f0             	mov    %eax,-0x10(%ebp)
    a = (uint*)bp->data;
80101d28:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101d2b:	83 c0 5c             	add    $0x5c,%eax
80101d2e:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if((addr = a[bn]) == 0){
80101d31:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d34:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101d3b:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101d3e:	01 d0                	add    %edx,%eax
80101d40:	8b 00                	mov    (%eax),%eax
80101d42:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101d45:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101d49:	75 36                	jne    80101d81 <bmap+0xfe>
      a[bn] = addr = balloc(ip->dev);
80101d4b:	8b 45 08             	mov    0x8(%ebp),%eax
80101d4e:	8b 00                	mov    (%eax),%eax
80101d50:	83 ec 0c             	sub    $0xc,%esp
80101d53:	50                   	push   %eax
80101d54:	e8 4e f7 ff ff       	call   801014a7 <balloc>
80101d59:	83 c4 10             	add    $0x10,%esp
80101d5c:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101d5f:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d62:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101d69:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101d6c:	01 c2                	add    %eax,%edx
80101d6e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101d71:	89 02                	mov    %eax,(%edx)
      log_write(bp);
80101d73:	83 ec 0c             	sub    $0xc,%esp
80101d76:	ff 75 f0             	push   -0x10(%ebp)
80101d79:	e8 1a 1a 00 00       	call   80103798 <log_write>
80101d7e:	83 c4 10             	add    $0x10,%esp
    }
    brelse(bp);
80101d81:	83 ec 0c             	sub    $0xc,%esp
80101d84:	ff 75 f0             	push   -0x10(%ebp)
80101d87:	e8 c5 e4 ff ff       	call   80100251 <brelse>
80101d8c:	83 c4 10             	add    $0x10,%esp
    return addr;
80101d8f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101d92:	eb 0d                	jmp    80101da1 <bmap+0x11e>
  }

  panic("bmap: out of range");
80101d94:	83 ec 0c             	sub    $0xc,%esp
80101d97:	68 0e 86 10 80       	push   $0x8010860e
80101d9c:	e8 14 e8 ff ff       	call   801005b5 <panic>
}
80101da1:	c9                   	leave  
80101da2:	c3                   	ret    

80101da3 <itrunc>:
// to it (no directory entries referring to it)
// and has no in-memory reference to it (is
// not an open file or current directory).
static void
itrunc(struct inode *ip)
{
80101da3:	55                   	push   %ebp
80101da4:	89 e5                	mov    %esp,%ebp
80101da6:	83 ec 18             	sub    $0x18,%esp
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
80101da9:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101db0:	eb 45                	jmp    80101df7 <itrunc+0x54>
    if(ip->addrs[i]){
80101db2:	8b 45 08             	mov    0x8(%ebp),%eax
80101db5:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101db8:	83 c2 14             	add    $0x14,%edx
80101dbb:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101dbf:	85 c0                	test   %eax,%eax
80101dc1:	74 30                	je     80101df3 <itrunc+0x50>
      bfree(ip->dev, ip->addrs[i]);
80101dc3:	8b 45 08             	mov    0x8(%ebp),%eax
80101dc6:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101dc9:	83 c2 14             	add    $0x14,%edx
80101dcc:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101dd0:	8b 55 08             	mov    0x8(%ebp),%edx
80101dd3:	8b 12                	mov    (%edx),%edx
80101dd5:	83 ec 08             	sub    $0x8,%esp
80101dd8:	50                   	push   %eax
80101dd9:	52                   	push   %edx
80101dda:	e8 0c f8 ff ff       	call   801015eb <bfree>
80101ddf:	83 c4 10             	add    $0x10,%esp
      ip->addrs[i] = 0;
80101de2:	8b 45 08             	mov    0x8(%ebp),%eax
80101de5:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101de8:	83 c2 14             	add    $0x14,%edx
80101deb:	c7 44 90 0c 00 00 00 	movl   $0x0,0xc(%eax,%edx,4)
80101df2:	00 
  for(i = 0; i < NDIRECT; i++){
80101df3:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80101df7:	83 7d f4 0b          	cmpl   $0xb,-0xc(%ebp)
80101dfb:	7e b5                	jle    80101db2 <itrunc+0xf>
    }
  }

  if(ip->addrs[NDIRECT]){
80101dfd:	8b 45 08             	mov    0x8(%ebp),%eax
80101e00:	8b 80 8c 00 00 00    	mov    0x8c(%eax),%eax
80101e06:	85 c0                	test   %eax,%eax
80101e08:	0f 84 aa 00 00 00    	je     80101eb8 <itrunc+0x115>
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101e0e:	8b 45 08             	mov    0x8(%ebp),%eax
80101e11:	8b 90 8c 00 00 00    	mov    0x8c(%eax),%edx
80101e17:	8b 45 08             	mov    0x8(%ebp),%eax
80101e1a:	8b 00                	mov    (%eax),%eax
80101e1c:	83 ec 08             	sub    $0x8,%esp
80101e1f:	52                   	push   %edx
80101e20:	50                   	push   %eax
80101e21:	e8 a9 e3 ff ff       	call   801001cf <bread>
80101e26:	83 c4 10             	add    $0x10,%esp
80101e29:	89 45 ec             	mov    %eax,-0x14(%ebp)
    a = (uint*)bp->data;
80101e2c:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101e2f:	83 c0 5c             	add    $0x5c,%eax
80101e32:	89 45 e8             	mov    %eax,-0x18(%ebp)
    for(j = 0; j < NINDIRECT; j++){
80101e35:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
80101e3c:	eb 3c                	jmp    80101e7a <itrunc+0xd7>
      if(a[j])
80101e3e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101e41:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101e48:	8b 45 e8             	mov    -0x18(%ebp),%eax
80101e4b:	01 d0                	add    %edx,%eax
80101e4d:	8b 00                	mov    (%eax),%eax
80101e4f:	85 c0                	test   %eax,%eax
80101e51:	74 23                	je     80101e76 <itrunc+0xd3>
        bfree(ip->dev, a[j]);
80101e53:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101e56:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101e5d:	8b 45 e8             	mov    -0x18(%ebp),%eax
80101e60:	01 d0                	add    %edx,%eax
80101e62:	8b 00                	mov    (%eax),%eax
80101e64:	8b 55 08             	mov    0x8(%ebp),%edx
80101e67:	8b 12                	mov    (%edx),%edx
80101e69:	83 ec 08             	sub    $0x8,%esp
80101e6c:	50                   	push   %eax
80101e6d:	52                   	push   %edx
80101e6e:	e8 78 f7 ff ff       	call   801015eb <bfree>
80101e73:	83 c4 10             	add    $0x10,%esp
    for(j = 0; j < NINDIRECT; j++){
80101e76:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
80101e7a:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101e7d:	83 f8 7f             	cmp    $0x7f,%eax
80101e80:	76 bc                	jbe    80101e3e <itrunc+0x9b>
    }
    brelse(bp);
80101e82:	83 ec 0c             	sub    $0xc,%esp
80101e85:	ff 75 ec             	push   -0x14(%ebp)
80101e88:	e8 c4 e3 ff ff       	call   80100251 <brelse>
80101e8d:	83 c4 10             	add    $0x10,%esp
    bfree(ip->dev, ip->addrs[NDIRECT]);
80101e90:	8b 45 08             	mov    0x8(%ebp),%eax
80101e93:	8b 80 8c 00 00 00    	mov    0x8c(%eax),%eax
80101e99:	8b 55 08             	mov    0x8(%ebp),%edx
80101e9c:	8b 12                	mov    (%edx),%edx
80101e9e:	83 ec 08             	sub    $0x8,%esp
80101ea1:	50                   	push   %eax
80101ea2:	52                   	push   %edx
80101ea3:	e8 43 f7 ff ff       	call   801015eb <bfree>
80101ea8:	83 c4 10             	add    $0x10,%esp
    ip->addrs[NDIRECT] = 0;
80101eab:	8b 45 08             	mov    0x8(%ebp),%eax
80101eae:	c7 80 8c 00 00 00 00 	movl   $0x0,0x8c(%eax)
80101eb5:	00 00 00 
  }

  ip->size = 0;
80101eb8:	8b 45 08             	mov    0x8(%ebp),%eax
80101ebb:	c7 40 58 00 00 00 00 	movl   $0x0,0x58(%eax)
  iupdate(ip);
80101ec2:	83 ec 0c             	sub    $0xc,%esp
80101ec5:	ff 75 08             	push   0x8(%ebp)
80101ec8:	e8 83 f9 ff ff       	call   80101850 <iupdate>
80101ecd:	83 c4 10             	add    $0x10,%esp
}
80101ed0:	90                   	nop
80101ed1:	c9                   	leave  
80101ed2:	c3                   	ret    

80101ed3 <stati>:

// Copy stat information from inode.
// Caller must hold ip->lock.
void
stati(struct inode *ip, struct stat *st)
{
80101ed3:	55                   	push   %ebp
80101ed4:	89 e5                	mov    %esp,%ebp
  st->dev = ip->dev;
80101ed6:	8b 45 08             	mov    0x8(%ebp),%eax
80101ed9:	8b 00                	mov    (%eax),%eax
80101edb:	89 c2                	mov    %eax,%edx
80101edd:	8b 45 0c             	mov    0xc(%ebp),%eax
80101ee0:	89 50 04             	mov    %edx,0x4(%eax)
  st->ino = ip->inum;
80101ee3:	8b 45 08             	mov    0x8(%ebp),%eax
80101ee6:	8b 50 04             	mov    0x4(%eax),%edx
80101ee9:	8b 45 0c             	mov    0xc(%ebp),%eax
80101eec:	89 50 08             	mov    %edx,0x8(%eax)
  st->type = ip->type;
80101eef:	8b 45 08             	mov    0x8(%ebp),%eax
80101ef2:	0f b7 50 50          	movzwl 0x50(%eax),%edx
80101ef6:	8b 45 0c             	mov    0xc(%ebp),%eax
80101ef9:	66 89 10             	mov    %dx,(%eax)
  st->nlink = ip->nlink;
80101efc:	8b 45 08             	mov    0x8(%ebp),%eax
80101eff:	0f b7 50 56          	movzwl 0x56(%eax),%edx
80101f03:	8b 45 0c             	mov    0xc(%ebp),%eax
80101f06:	66 89 50 0c          	mov    %dx,0xc(%eax)
  st->size = ip->size;
80101f0a:	8b 45 08             	mov    0x8(%ebp),%eax
80101f0d:	8b 50 58             	mov    0x58(%eax),%edx
80101f10:	8b 45 0c             	mov    0xc(%ebp),%eax
80101f13:	89 50 10             	mov    %edx,0x10(%eax)
}
80101f16:	90                   	nop
80101f17:	5d                   	pop    %ebp
80101f18:	c3                   	ret    

80101f19 <readi>:
//PAGEBREAK!
// Read data from inode.
// Caller must hold ip->lock.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101f19:	55                   	push   %ebp
80101f1a:	89 e5                	mov    %esp,%ebp
80101f1c:	83 ec 18             	sub    $0x18,%esp
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
80101f1f:	8b 45 08             	mov    0x8(%ebp),%eax
80101f22:	0f b7 40 50          	movzwl 0x50(%eax),%eax
80101f26:	66 83 f8 03          	cmp    $0x3,%ax
80101f2a:	75 5c                	jne    80101f88 <readi+0x6f>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101f2c:	8b 45 08             	mov    0x8(%ebp),%eax
80101f2f:	0f b7 40 52          	movzwl 0x52(%eax),%eax
80101f33:	66 85 c0             	test   %ax,%ax
80101f36:	78 20                	js     80101f58 <readi+0x3f>
80101f38:	8b 45 08             	mov    0x8(%ebp),%eax
80101f3b:	0f b7 40 52          	movzwl 0x52(%eax),%eax
80101f3f:	66 83 f8 09          	cmp    $0x9,%ax
80101f43:	7f 13                	jg     80101f58 <readi+0x3f>
80101f45:	8b 45 08             	mov    0x8(%ebp),%eax
80101f48:	0f b7 40 52          	movzwl 0x52(%eax),%eax
80101f4c:	98                   	cwtl   
80101f4d:	8b 04 c5 c0 ff 10 80 	mov    -0x7fef0040(,%eax,8),%eax
80101f54:	85 c0                	test   %eax,%eax
80101f56:	75 0a                	jne    80101f62 <readi+0x49>
      return -1;
80101f58:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101f5d:	e9 0a 01 00 00       	jmp    8010206c <readi+0x153>
    return devsw[ip->major].read(ip, dst, n);
80101f62:	8b 45 08             	mov    0x8(%ebp),%eax
80101f65:	0f b7 40 52          	movzwl 0x52(%eax),%eax
80101f69:	98                   	cwtl   
80101f6a:	8b 04 c5 c0 ff 10 80 	mov    -0x7fef0040(,%eax,8),%eax
80101f71:	8b 55 14             	mov    0x14(%ebp),%edx
80101f74:	83 ec 04             	sub    $0x4,%esp
80101f77:	52                   	push   %edx
80101f78:	ff 75 0c             	push   0xc(%ebp)
80101f7b:	ff 75 08             	push   0x8(%ebp)
80101f7e:	ff d0                	call   *%eax
80101f80:	83 c4 10             	add    $0x10,%esp
80101f83:	e9 e4 00 00 00       	jmp    8010206c <readi+0x153>
  }

  if(off > ip->size || off + n < off)
80101f88:	8b 45 08             	mov    0x8(%ebp),%eax
80101f8b:	8b 40 58             	mov    0x58(%eax),%eax
80101f8e:	39 45 10             	cmp    %eax,0x10(%ebp)
80101f91:	77 0d                	ja     80101fa0 <readi+0x87>
80101f93:	8b 55 10             	mov    0x10(%ebp),%edx
80101f96:	8b 45 14             	mov    0x14(%ebp),%eax
80101f99:	01 d0                	add    %edx,%eax
80101f9b:	39 45 10             	cmp    %eax,0x10(%ebp)
80101f9e:	76 0a                	jbe    80101faa <readi+0x91>
    return -1;
80101fa0:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101fa5:	e9 c2 00 00 00       	jmp    8010206c <readi+0x153>
  if(off + n > ip->size)
80101faa:	8b 55 10             	mov    0x10(%ebp),%edx
80101fad:	8b 45 14             	mov    0x14(%ebp),%eax
80101fb0:	01 c2                	add    %eax,%edx
80101fb2:	8b 45 08             	mov    0x8(%ebp),%eax
80101fb5:	8b 40 58             	mov    0x58(%eax),%eax
80101fb8:	39 c2                	cmp    %eax,%edx
80101fba:	76 0c                	jbe    80101fc8 <readi+0xaf>
    n = ip->size - off;
80101fbc:	8b 45 08             	mov    0x8(%ebp),%eax
80101fbf:	8b 40 58             	mov    0x58(%eax),%eax
80101fc2:	2b 45 10             	sub    0x10(%ebp),%eax
80101fc5:	89 45 14             	mov    %eax,0x14(%ebp)

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101fc8:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101fcf:	e9 89 00 00 00       	jmp    8010205d <readi+0x144>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101fd4:	8b 45 10             	mov    0x10(%ebp),%eax
80101fd7:	c1 e8 09             	shr    $0x9,%eax
80101fda:	83 ec 08             	sub    $0x8,%esp
80101fdd:	50                   	push   %eax
80101fde:	ff 75 08             	push   0x8(%ebp)
80101fe1:	e8 9d fc ff ff       	call   80101c83 <bmap>
80101fe6:	83 c4 10             	add    $0x10,%esp
80101fe9:	8b 55 08             	mov    0x8(%ebp),%edx
80101fec:	8b 12                	mov    (%edx),%edx
80101fee:	83 ec 08             	sub    $0x8,%esp
80101ff1:	50                   	push   %eax
80101ff2:	52                   	push   %edx
80101ff3:	e8 d7 e1 ff ff       	call   801001cf <bread>
80101ff8:	83 c4 10             	add    $0x10,%esp
80101ffb:	89 45 f0             	mov    %eax,-0x10(%ebp)
    m = min(n - tot, BSIZE - off%BSIZE);
80101ffe:	8b 45 10             	mov    0x10(%ebp),%eax
80102001:	25 ff 01 00 00       	and    $0x1ff,%eax
80102006:	ba 00 02 00 00       	mov    $0x200,%edx
8010200b:	29 c2                	sub    %eax,%edx
8010200d:	8b 45 14             	mov    0x14(%ebp),%eax
80102010:	2b 45 f4             	sub    -0xc(%ebp),%eax
80102013:	39 c2                	cmp    %eax,%edx
80102015:	0f 46 c2             	cmovbe %edx,%eax
80102018:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(dst, bp->data + off%BSIZE, m);
8010201b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010201e:	8d 50 5c             	lea    0x5c(%eax),%edx
80102021:	8b 45 10             	mov    0x10(%ebp),%eax
80102024:	25 ff 01 00 00       	and    $0x1ff,%eax
80102029:	01 d0                	add    %edx,%eax
8010202b:	83 ec 04             	sub    $0x4,%esp
8010202e:	ff 75 ec             	push   -0x14(%ebp)
80102031:	50                   	push   %eax
80102032:	ff 75 0c             	push   0xc(%ebp)
80102035:	e8 b5 32 00 00       	call   801052ef <memmove>
8010203a:	83 c4 10             	add    $0x10,%esp
    brelse(bp);
8010203d:	83 ec 0c             	sub    $0xc,%esp
80102040:	ff 75 f0             	push   -0x10(%ebp)
80102043:	e8 09 e2 ff ff       	call   80100251 <brelse>
80102048:	83 c4 10             	add    $0x10,%esp
  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
8010204b:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010204e:	01 45 f4             	add    %eax,-0xc(%ebp)
80102051:	8b 45 ec             	mov    -0x14(%ebp),%eax
80102054:	01 45 10             	add    %eax,0x10(%ebp)
80102057:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010205a:	01 45 0c             	add    %eax,0xc(%ebp)
8010205d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102060:	3b 45 14             	cmp    0x14(%ebp),%eax
80102063:	0f 82 6b ff ff ff    	jb     80101fd4 <readi+0xbb>
  }
  return n;
80102069:	8b 45 14             	mov    0x14(%ebp),%eax
}
8010206c:	c9                   	leave  
8010206d:	c3                   	ret    

8010206e <writei>:
// PAGEBREAK!
// Write data to inode.
// Caller must hold ip->lock.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
8010206e:	55                   	push   %ebp
8010206f:	89 e5                	mov    %esp,%ebp
80102071:	83 ec 18             	sub    $0x18,%esp
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
80102074:	8b 45 08             	mov    0x8(%ebp),%eax
80102077:	0f b7 40 50          	movzwl 0x50(%eax),%eax
8010207b:	66 83 f8 03          	cmp    $0x3,%ax
8010207f:	75 5c                	jne    801020dd <writei+0x6f>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80102081:	8b 45 08             	mov    0x8(%ebp),%eax
80102084:	0f b7 40 52          	movzwl 0x52(%eax),%eax
80102088:	66 85 c0             	test   %ax,%ax
8010208b:	78 20                	js     801020ad <writei+0x3f>
8010208d:	8b 45 08             	mov    0x8(%ebp),%eax
80102090:	0f b7 40 52          	movzwl 0x52(%eax),%eax
80102094:	66 83 f8 09          	cmp    $0x9,%ax
80102098:	7f 13                	jg     801020ad <writei+0x3f>
8010209a:	8b 45 08             	mov    0x8(%ebp),%eax
8010209d:	0f b7 40 52          	movzwl 0x52(%eax),%eax
801020a1:	98                   	cwtl   
801020a2:	8b 04 c5 c4 ff 10 80 	mov    -0x7fef003c(,%eax,8),%eax
801020a9:	85 c0                	test   %eax,%eax
801020ab:	75 0a                	jne    801020b7 <writei+0x49>
      return -1;
801020ad:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801020b2:	e9 3b 01 00 00       	jmp    801021f2 <writei+0x184>
    return devsw[ip->major].write(ip, src, n);
801020b7:	8b 45 08             	mov    0x8(%ebp),%eax
801020ba:	0f b7 40 52          	movzwl 0x52(%eax),%eax
801020be:	98                   	cwtl   
801020bf:	8b 04 c5 c4 ff 10 80 	mov    -0x7fef003c(,%eax,8),%eax
801020c6:	8b 55 14             	mov    0x14(%ebp),%edx
801020c9:	83 ec 04             	sub    $0x4,%esp
801020cc:	52                   	push   %edx
801020cd:	ff 75 0c             	push   0xc(%ebp)
801020d0:	ff 75 08             	push   0x8(%ebp)
801020d3:	ff d0                	call   *%eax
801020d5:	83 c4 10             	add    $0x10,%esp
801020d8:	e9 15 01 00 00       	jmp    801021f2 <writei+0x184>
  }

  if(off > ip->size || off + n < off)
801020dd:	8b 45 08             	mov    0x8(%ebp),%eax
801020e0:	8b 40 58             	mov    0x58(%eax),%eax
801020e3:	39 45 10             	cmp    %eax,0x10(%ebp)
801020e6:	77 0d                	ja     801020f5 <writei+0x87>
801020e8:	8b 55 10             	mov    0x10(%ebp),%edx
801020eb:	8b 45 14             	mov    0x14(%ebp),%eax
801020ee:	01 d0                	add    %edx,%eax
801020f0:	39 45 10             	cmp    %eax,0x10(%ebp)
801020f3:	76 0a                	jbe    801020ff <writei+0x91>
    return -1;
801020f5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801020fa:	e9 f3 00 00 00       	jmp    801021f2 <writei+0x184>
  if(off + n > MAXFILE*BSIZE)
801020ff:	8b 55 10             	mov    0x10(%ebp),%edx
80102102:	8b 45 14             	mov    0x14(%ebp),%eax
80102105:	01 d0                	add    %edx,%eax
80102107:	3d 00 18 01 00       	cmp    $0x11800,%eax
8010210c:	76 0a                	jbe    80102118 <writei+0xaa>
    return -1;
8010210e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80102113:	e9 da 00 00 00       	jmp    801021f2 <writei+0x184>

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80102118:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010211f:	e9 97 00 00 00       	jmp    801021bb <writei+0x14d>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
80102124:	8b 45 10             	mov    0x10(%ebp),%eax
80102127:	c1 e8 09             	shr    $0x9,%eax
8010212a:	83 ec 08             	sub    $0x8,%esp
8010212d:	50                   	push   %eax
8010212e:	ff 75 08             	push   0x8(%ebp)
80102131:	e8 4d fb ff ff       	call   80101c83 <bmap>
80102136:	83 c4 10             	add    $0x10,%esp
80102139:	8b 55 08             	mov    0x8(%ebp),%edx
8010213c:	8b 12                	mov    (%edx),%edx
8010213e:	83 ec 08             	sub    $0x8,%esp
80102141:	50                   	push   %eax
80102142:	52                   	push   %edx
80102143:	e8 87 e0 ff ff       	call   801001cf <bread>
80102148:	83 c4 10             	add    $0x10,%esp
8010214b:	89 45 f0             	mov    %eax,-0x10(%ebp)
    m = min(n - tot, BSIZE - off%BSIZE);
8010214e:	8b 45 10             	mov    0x10(%ebp),%eax
80102151:	25 ff 01 00 00       	and    $0x1ff,%eax
80102156:	ba 00 02 00 00       	mov    $0x200,%edx
8010215b:	29 c2                	sub    %eax,%edx
8010215d:	8b 45 14             	mov    0x14(%ebp),%eax
80102160:	2b 45 f4             	sub    -0xc(%ebp),%eax
80102163:	39 c2                	cmp    %eax,%edx
80102165:	0f 46 c2             	cmovbe %edx,%eax
80102168:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(bp->data + off%BSIZE, src, m);
8010216b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010216e:	8d 50 5c             	lea    0x5c(%eax),%edx
80102171:	8b 45 10             	mov    0x10(%ebp),%eax
80102174:	25 ff 01 00 00       	and    $0x1ff,%eax
80102179:	01 d0                	add    %edx,%eax
8010217b:	83 ec 04             	sub    $0x4,%esp
8010217e:	ff 75 ec             	push   -0x14(%ebp)
80102181:	ff 75 0c             	push   0xc(%ebp)
80102184:	50                   	push   %eax
80102185:	e8 65 31 00 00       	call   801052ef <memmove>
8010218a:	83 c4 10             	add    $0x10,%esp
    log_write(bp);
8010218d:	83 ec 0c             	sub    $0xc,%esp
80102190:	ff 75 f0             	push   -0x10(%ebp)
80102193:	e8 00 16 00 00       	call   80103798 <log_write>
80102198:	83 c4 10             	add    $0x10,%esp
    brelse(bp);
8010219b:	83 ec 0c             	sub    $0xc,%esp
8010219e:	ff 75 f0             	push   -0x10(%ebp)
801021a1:	e8 ab e0 ff ff       	call   80100251 <brelse>
801021a6:	83 c4 10             	add    $0x10,%esp
  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
801021a9:	8b 45 ec             	mov    -0x14(%ebp),%eax
801021ac:	01 45 f4             	add    %eax,-0xc(%ebp)
801021af:	8b 45 ec             	mov    -0x14(%ebp),%eax
801021b2:	01 45 10             	add    %eax,0x10(%ebp)
801021b5:	8b 45 ec             	mov    -0x14(%ebp),%eax
801021b8:	01 45 0c             	add    %eax,0xc(%ebp)
801021bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801021be:	3b 45 14             	cmp    0x14(%ebp),%eax
801021c1:	0f 82 5d ff ff ff    	jb     80102124 <writei+0xb6>
  }

  if(n > 0 && off > ip->size){
801021c7:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
801021cb:	74 22                	je     801021ef <writei+0x181>
801021cd:	8b 45 08             	mov    0x8(%ebp),%eax
801021d0:	8b 40 58             	mov    0x58(%eax),%eax
801021d3:	39 45 10             	cmp    %eax,0x10(%ebp)
801021d6:	76 17                	jbe    801021ef <writei+0x181>
    ip->size = off;
801021d8:	8b 45 08             	mov    0x8(%ebp),%eax
801021db:	8b 55 10             	mov    0x10(%ebp),%edx
801021de:	89 50 58             	mov    %edx,0x58(%eax)
    iupdate(ip);
801021e1:	83 ec 0c             	sub    $0xc,%esp
801021e4:	ff 75 08             	push   0x8(%ebp)
801021e7:	e8 64 f6 ff ff       	call   80101850 <iupdate>
801021ec:	83 c4 10             	add    $0x10,%esp
  }
  return n;
801021ef:	8b 45 14             	mov    0x14(%ebp),%eax
}
801021f2:	c9                   	leave  
801021f3:	c3                   	ret    

801021f4 <namecmp>:
//PAGEBREAK!
// Directories

int
namecmp(const char *s, const char *t)
{
801021f4:	55                   	push   %ebp
801021f5:	89 e5                	mov    %esp,%ebp
801021f7:	83 ec 08             	sub    $0x8,%esp
  return strncmp(s, t, DIRSIZ);
801021fa:	83 ec 04             	sub    $0x4,%esp
801021fd:	6a 0e                	push   $0xe
801021ff:	ff 75 0c             	push   0xc(%ebp)
80102202:	ff 75 08             	push   0x8(%ebp)
80102205:	e8 7b 31 00 00       	call   80105385 <strncmp>
8010220a:	83 c4 10             	add    $0x10,%esp
}
8010220d:	c9                   	leave  
8010220e:	c3                   	ret    

8010220f <dirlookup>:

// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
8010220f:	55                   	push   %ebp
80102210:	89 e5                	mov    %esp,%ebp
80102212:	83 ec 28             	sub    $0x28,%esp
  uint off, inum;
  struct dirent de;

  if(dp->type != T_DIR)
80102215:	8b 45 08             	mov    0x8(%ebp),%eax
80102218:	0f b7 40 50          	movzwl 0x50(%eax),%eax
8010221c:	66 83 f8 01          	cmp    $0x1,%ax
80102220:	74 0d                	je     8010222f <dirlookup+0x20>
    panic("dirlookup not DIR");
80102222:	83 ec 0c             	sub    $0xc,%esp
80102225:	68 21 86 10 80       	push   $0x80108621
8010222a:	e8 86 e3 ff ff       	call   801005b5 <panic>

  for(off = 0; off < dp->size; off += sizeof(de)){
8010222f:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80102236:	eb 7b                	jmp    801022b3 <dirlookup+0xa4>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102238:	6a 10                	push   $0x10
8010223a:	ff 75 f4             	push   -0xc(%ebp)
8010223d:	8d 45 e0             	lea    -0x20(%ebp),%eax
80102240:	50                   	push   %eax
80102241:	ff 75 08             	push   0x8(%ebp)
80102244:	e8 d0 fc ff ff       	call   80101f19 <readi>
80102249:	83 c4 10             	add    $0x10,%esp
8010224c:	83 f8 10             	cmp    $0x10,%eax
8010224f:	74 0d                	je     8010225e <dirlookup+0x4f>
      panic("dirlookup read");
80102251:	83 ec 0c             	sub    $0xc,%esp
80102254:	68 33 86 10 80       	push   $0x80108633
80102259:	e8 57 e3 ff ff       	call   801005b5 <panic>
    if(de.inum == 0)
8010225e:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
80102262:	66 85 c0             	test   %ax,%ax
80102265:	74 47                	je     801022ae <dirlookup+0x9f>
      continue;
    if(namecmp(name, de.name) == 0){
80102267:	83 ec 08             	sub    $0x8,%esp
8010226a:	8d 45 e0             	lea    -0x20(%ebp),%eax
8010226d:	83 c0 02             	add    $0x2,%eax
80102270:	50                   	push   %eax
80102271:	ff 75 0c             	push   0xc(%ebp)
80102274:	e8 7b ff ff ff       	call   801021f4 <namecmp>
80102279:	83 c4 10             	add    $0x10,%esp
8010227c:	85 c0                	test   %eax,%eax
8010227e:	75 2f                	jne    801022af <dirlookup+0xa0>
      // entry matches path element
      if(poff)
80102280:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80102284:	74 08                	je     8010228e <dirlookup+0x7f>
        *poff = off;
80102286:	8b 45 10             	mov    0x10(%ebp),%eax
80102289:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010228c:	89 10                	mov    %edx,(%eax)
      inum = de.inum;
8010228e:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
80102292:	0f b7 c0             	movzwl %ax,%eax
80102295:	89 45 f0             	mov    %eax,-0x10(%ebp)
      return iget(dp->dev, inum);
80102298:	8b 45 08             	mov    0x8(%ebp),%eax
8010229b:	8b 00                	mov    (%eax),%eax
8010229d:	83 ec 08             	sub    $0x8,%esp
801022a0:	ff 75 f0             	push   -0x10(%ebp)
801022a3:	50                   	push   %eax
801022a4:	e8 68 f6 ff ff       	call   80101911 <iget>
801022a9:	83 c4 10             	add    $0x10,%esp
801022ac:	eb 19                	jmp    801022c7 <dirlookup+0xb8>
      continue;
801022ae:	90                   	nop
  for(off = 0; off < dp->size; off += sizeof(de)){
801022af:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
801022b3:	8b 45 08             	mov    0x8(%ebp),%eax
801022b6:	8b 40 58             	mov    0x58(%eax),%eax
801022b9:	39 45 f4             	cmp    %eax,-0xc(%ebp)
801022bc:	0f 82 76 ff ff ff    	jb     80102238 <dirlookup+0x29>
    }
  }

  return 0;
801022c2:	b8 00 00 00 00       	mov    $0x0,%eax
}
801022c7:	c9                   	leave  
801022c8:	c3                   	ret    

801022c9 <dirlink>:

// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
801022c9:	55                   	push   %ebp
801022ca:	89 e5                	mov    %esp,%ebp
801022cc:	83 ec 28             	sub    $0x28,%esp
  int off;
  struct dirent de;
  struct inode *ip;

  // Check that name is not present.
  if((ip = dirlookup(dp, name, 0)) != 0){
801022cf:	83 ec 04             	sub    $0x4,%esp
801022d2:	6a 00                	push   $0x0
801022d4:	ff 75 0c             	push   0xc(%ebp)
801022d7:	ff 75 08             	push   0x8(%ebp)
801022da:	e8 30 ff ff ff       	call   8010220f <dirlookup>
801022df:	83 c4 10             	add    $0x10,%esp
801022e2:	89 45 f0             	mov    %eax,-0x10(%ebp)
801022e5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801022e9:	74 18                	je     80102303 <dirlink+0x3a>
    iput(ip);
801022eb:	83 ec 0c             	sub    $0xc,%esp
801022ee:	ff 75 f0             	push   -0x10(%ebp)
801022f1:	e8 98 f8 ff ff       	call   80101b8e <iput>
801022f6:	83 c4 10             	add    $0x10,%esp
    return -1;
801022f9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801022fe:	e9 9c 00 00 00       	jmp    8010239f <dirlink+0xd6>
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
80102303:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010230a:	eb 39                	jmp    80102345 <dirlink+0x7c>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
8010230c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010230f:	6a 10                	push   $0x10
80102311:	50                   	push   %eax
80102312:	8d 45 e0             	lea    -0x20(%ebp),%eax
80102315:	50                   	push   %eax
80102316:	ff 75 08             	push   0x8(%ebp)
80102319:	e8 fb fb ff ff       	call   80101f19 <readi>
8010231e:	83 c4 10             	add    $0x10,%esp
80102321:	83 f8 10             	cmp    $0x10,%eax
80102324:	74 0d                	je     80102333 <dirlink+0x6a>
      panic("dirlink read");
80102326:	83 ec 0c             	sub    $0xc,%esp
80102329:	68 42 86 10 80       	push   $0x80108642
8010232e:	e8 82 e2 ff ff       	call   801005b5 <panic>
    if(de.inum == 0)
80102333:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
80102337:	66 85 c0             	test   %ax,%ax
8010233a:	74 18                	je     80102354 <dirlink+0x8b>
  for(off = 0; off < dp->size; off += sizeof(de)){
8010233c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010233f:	83 c0 10             	add    $0x10,%eax
80102342:	89 45 f4             	mov    %eax,-0xc(%ebp)
80102345:	8b 45 08             	mov    0x8(%ebp),%eax
80102348:	8b 50 58             	mov    0x58(%eax),%edx
8010234b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010234e:	39 c2                	cmp    %eax,%edx
80102350:	77 ba                	ja     8010230c <dirlink+0x43>
80102352:	eb 01                	jmp    80102355 <dirlink+0x8c>
      break;
80102354:	90                   	nop
  }

  strncpy(de.name, name, DIRSIZ);
80102355:	83 ec 04             	sub    $0x4,%esp
80102358:	6a 0e                	push   $0xe
8010235a:	ff 75 0c             	push   0xc(%ebp)
8010235d:	8d 45 e0             	lea    -0x20(%ebp),%eax
80102360:	83 c0 02             	add    $0x2,%eax
80102363:	50                   	push   %eax
80102364:	e8 72 30 00 00       	call   801053db <strncpy>
80102369:	83 c4 10             	add    $0x10,%esp
  de.inum = inum;
8010236c:	8b 45 10             	mov    0x10(%ebp),%eax
8010236f:	66 89 45 e0          	mov    %ax,-0x20(%ebp)
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102373:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102376:	6a 10                	push   $0x10
80102378:	50                   	push   %eax
80102379:	8d 45 e0             	lea    -0x20(%ebp),%eax
8010237c:	50                   	push   %eax
8010237d:	ff 75 08             	push   0x8(%ebp)
80102380:	e8 e9 fc ff ff       	call   8010206e <writei>
80102385:	83 c4 10             	add    $0x10,%esp
80102388:	83 f8 10             	cmp    $0x10,%eax
8010238b:	74 0d                	je     8010239a <dirlink+0xd1>
    panic("dirlink");
8010238d:	83 ec 0c             	sub    $0xc,%esp
80102390:	68 4f 86 10 80       	push   $0x8010864f
80102395:	e8 1b e2 ff ff       	call   801005b5 <panic>

  return 0;
8010239a:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010239f:	c9                   	leave  
801023a0:	c3                   	ret    

801023a1 <skipelem>:
//   skipelem("a", name) = "", setting name = "a"
//   skipelem("", name) = skipelem("////", name) = 0
//
static char*
skipelem(char *path, char *name)
{
801023a1:	55                   	push   %ebp
801023a2:	89 e5                	mov    %esp,%ebp
801023a4:	83 ec 18             	sub    $0x18,%esp
  char *s;
  int len;

  while(*path == '/')
801023a7:	eb 04                	jmp    801023ad <skipelem+0xc>
    path++;
801023a9:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  while(*path == '/')
801023ad:	8b 45 08             	mov    0x8(%ebp),%eax
801023b0:	0f b6 00             	movzbl (%eax),%eax
801023b3:	3c 2f                	cmp    $0x2f,%al
801023b5:	74 f2                	je     801023a9 <skipelem+0x8>
  if(*path == 0)
801023b7:	8b 45 08             	mov    0x8(%ebp),%eax
801023ba:	0f b6 00             	movzbl (%eax),%eax
801023bd:	84 c0                	test   %al,%al
801023bf:	75 07                	jne    801023c8 <skipelem+0x27>
    return 0;
801023c1:	b8 00 00 00 00       	mov    $0x0,%eax
801023c6:	eb 77                	jmp    8010243f <skipelem+0x9e>
  s = path;
801023c8:	8b 45 08             	mov    0x8(%ebp),%eax
801023cb:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(*path != '/' && *path != 0)
801023ce:	eb 04                	jmp    801023d4 <skipelem+0x33>
    path++;
801023d0:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  while(*path != '/' && *path != 0)
801023d4:	8b 45 08             	mov    0x8(%ebp),%eax
801023d7:	0f b6 00             	movzbl (%eax),%eax
801023da:	3c 2f                	cmp    $0x2f,%al
801023dc:	74 0a                	je     801023e8 <skipelem+0x47>
801023de:	8b 45 08             	mov    0x8(%ebp),%eax
801023e1:	0f b6 00             	movzbl (%eax),%eax
801023e4:	84 c0                	test   %al,%al
801023e6:	75 e8                	jne    801023d0 <skipelem+0x2f>
  len = path - s;
801023e8:	8b 45 08             	mov    0x8(%ebp),%eax
801023eb:	2b 45 f4             	sub    -0xc(%ebp),%eax
801023ee:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(len >= DIRSIZ)
801023f1:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
801023f5:	7e 15                	jle    8010240c <skipelem+0x6b>
    memmove(name, s, DIRSIZ);
801023f7:	83 ec 04             	sub    $0x4,%esp
801023fa:	6a 0e                	push   $0xe
801023fc:	ff 75 f4             	push   -0xc(%ebp)
801023ff:	ff 75 0c             	push   0xc(%ebp)
80102402:	e8 e8 2e 00 00       	call   801052ef <memmove>
80102407:	83 c4 10             	add    $0x10,%esp
8010240a:	eb 26                	jmp    80102432 <skipelem+0x91>
  else {
    memmove(name, s, len);
8010240c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010240f:	83 ec 04             	sub    $0x4,%esp
80102412:	50                   	push   %eax
80102413:	ff 75 f4             	push   -0xc(%ebp)
80102416:	ff 75 0c             	push   0xc(%ebp)
80102419:	e8 d1 2e 00 00       	call   801052ef <memmove>
8010241e:	83 c4 10             	add    $0x10,%esp
    name[len] = 0;
80102421:	8b 55 f0             	mov    -0x10(%ebp),%edx
80102424:	8b 45 0c             	mov    0xc(%ebp),%eax
80102427:	01 d0                	add    %edx,%eax
80102429:	c6 00 00             	movb   $0x0,(%eax)
  }
  while(*path == '/')
8010242c:	eb 04                	jmp    80102432 <skipelem+0x91>
    path++;
8010242e:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  while(*path == '/')
80102432:	8b 45 08             	mov    0x8(%ebp),%eax
80102435:	0f b6 00             	movzbl (%eax),%eax
80102438:	3c 2f                	cmp    $0x2f,%al
8010243a:	74 f2                	je     8010242e <skipelem+0x8d>
  return path;
8010243c:	8b 45 08             	mov    0x8(%ebp),%eax
}
8010243f:	c9                   	leave  
80102440:	c3                   	ret    

80102441 <namex>:
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80102441:	55                   	push   %ebp
80102442:	89 e5                	mov    %esp,%ebp
80102444:	83 ec 18             	sub    $0x18,%esp
  struct inode *ip, *next;

  if(*path == '/')
80102447:	8b 45 08             	mov    0x8(%ebp),%eax
8010244a:	0f b6 00             	movzbl (%eax),%eax
8010244d:	3c 2f                	cmp    $0x2f,%al
8010244f:	75 17                	jne    80102468 <namex+0x27>
    ip = iget(ROOTDEV, ROOTINO);
80102451:	83 ec 08             	sub    $0x8,%esp
80102454:	6a 01                	push   $0x1
80102456:	6a 01                	push   $0x1
80102458:	e8 b4 f4 ff ff       	call   80101911 <iget>
8010245d:	83 c4 10             	add    $0x10,%esp
80102460:	89 45 f4             	mov    %eax,-0xc(%ebp)
80102463:	e9 ba 00 00 00       	jmp    80102522 <namex+0xe1>
  else
    ip = idup(myproc()->cwd);
80102468:	e8 6f 1e 00 00       	call   801042dc <myproc>
8010246d:	8b 40 68             	mov    0x68(%eax),%eax
80102470:	83 ec 0c             	sub    $0xc,%esp
80102473:	50                   	push   %eax
80102474:	e8 7a f5 ff ff       	call   801019f3 <idup>
80102479:	83 c4 10             	add    $0x10,%esp
8010247c:	89 45 f4             	mov    %eax,-0xc(%ebp)

  while((path = skipelem(path, name)) != 0){
8010247f:	e9 9e 00 00 00       	jmp    80102522 <namex+0xe1>
    ilock(ip);
80102484:	83 ec 0c             	sub    $0xc,%esp
80102487:	ff 75 f4             	push   -0xc(%ebp)
8010248a:	e8 9e f5 ff ff       	call   80101a2d <ilock>
8010248f:	83 c4 10             	add    $0x10,%esp
    if(ip->type != T_DIR){
80102492:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102495:	0f b7 40 50          	movzwl 0x50(%eax),%eax
80102499:	66 83 f8 01          	cmp    $0x1,%ax
8010249d:	74 18                	je     801024b7 <namex+0x76>
      iunlockput(ip);
8010249f:	83 ec 0c             	sub    $0xc,%esp
801024a2:	ff 75 f4             	push   -0xc(%ebp)
801024a5:	e8 b4 f7 ff ff       	call   80101c5e <iunlockput>
801024aa:	83 c4 10             	add    $0x10,%esp
      return 0;
801024ad:	b8 00 00 00 00       	mov    $0x0,%eax
801024b2:	e9 a7 00 00 00       	jmp    8010255e <namex+0x11d>
    }
    if(nameiparent && *path == '\0'){
801024b7:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801024bb:	74 20                	je     801024dd <namex+0x9c>
801024bd:	8b 45 08             	mov    0x8(%ebp),%eax
801024c0:	0f b6 00             	movzbl (%eax),%eax
801024c3:	84 c0                	test   %al,%al
801024c5:	75 16                	jne    801024dd <namex+0x9c>
      // Stop one level early.
      iunlock(ip);
801024c7:	83 ec 0c             	sub    $0xc,%esp
801024ca:	ff 75 f4             	push   -0xc(%ebp)
801024cd:	e8 6e f6 ff ff       	call   80101b40 <iunlock>
801024d2:	83 c4 10             	add    $0x10,%esp
      return ip;
801024d5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801024d8:	e9 81 00 00 00       	jmp    8010255e <namex+0x11d>
    }
    if((next = dirlookup(ip, name, 0)) == 0){
801024dd:	83 ec 04             	sub    $0x4,%esp
801024e0:	6a 00                	push   $0x0
801024e2:	ff 75 10             	push   0x10(%ebp)
801024e5:	ff 75 f4             	push   -0xc(%ebp)
801024e8:	e8 22 fd ff ff       	call   8010220f <dirlookup>
801024ed:	83 c4 10             	add    $0x10,%esp
801024f0:	89 45 f0             	mov    %eax,-0x10(%ebp)
801024f3:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801024f7:	75 15                	jne    8010250e <namex+0xcd>
      iunlockput(ip);
801024f9:	83 ec 0c             	sub    $0xc,%esp
801024fc:	ff 75 f4             	push   -0xc(%ebp)
801024ff:	e8 5a f7 ff ff       	call   80101c5e <iunlockput>
80102504:	83 c4 10             	add    $0x10,%esp
      return 0;
80102507:	b8 00 00 00 00       	mov    $0x0,%eax
8010250c:	eb 50                	jmp    8010255e <namex+0x11d>
    }
    iunlockput(ip);
8010250e:	83 ec 0c             	sub    $0xc,%esp
80102511:	ff 75 f4             	push   -0xc(%ebp)
80102514:	e8 45 f7 ff ff       	call   80101c5e <iunlockput>
80102519:	83 c4 10             	add    $0x10,%esp
    ip = next;
8010251c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010251f:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while((path = skipelem(path, name)) != 0){
80102522:	83 ec 08             	sub    $0x8,%esp
80102525:	ff 75 10             	push   0x10(%ebp)
80102528:	ff 75 08             	push   0x8(%ebp)
8010252b:	e8 71 fe ff ff       	call   801023a1 <skipelem>
80102530:	83 c4 10             	add    $0x10,%esp
80102533:	89 45 08             	mov    %eax,0x8(%ebp)
80102536:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010253a:	0f 85 44 ff ff ff    	jne    80102484 <namex+0x43>
  }
  if(nameiparent){
80102540:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80102544:	74 15                	je     8010255b <namex+0x11a>
    iput(ip);
80102546:	83 ec 0c             	sub    $0xc,%esp
80102549:	ff 75 f4             	push   -0xc(%ebp)
8010254c:	e8 3d f6 ff ff       	call   80101b8e <iput>
80102551:	83 c4 10             	add    $0x10,%esp
    return 0;
80102554:	b8 00 00 00 00       	mov    $0x0,%eax
80102559:	eb 03                	jmp    8010255e <namex+0x11d>
  }
  return ip;
8010255b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
8010255e:	c9                   	leave  
8010255f:	c3                   	ret    

80102560 <namei>:

struct inode*
namei(char *path)
{
80102560:	55                   	push   %ebp
80102561:	89 e5                	mov    %esp,%ebp
80102563:	83 ec 18             	sub    $0x18,%esp
  char name[DIRSIZ];
  return namex(path, 0, name);
80102566:	83 ec 04             	sub    $0x4,%esp
80102569:	8d 45 ea             	lea    -0x16(%ebp),%eax
8010256c:	50                   	push   %eax
8010256d:	6a 00                	push   $0x0
8010256f:	ff 75 08             	push   0x8(%ebp)
80102572:	e8 ca fe ff ff       	call   80102441 <namex>
80102577:	83 c4 10             	add    $0x10,%esp
}
8010257a:	c9                   	leave  
8010257b:	c3                   	ret    

8010257c <nameiparent>:

struct inode*
nameiparent(char *path, char *name)
{
8010257c:	55                   	push   %ebp
8010257d:	89 e5                	mov    %esp,%ebp
8010257f:	83 ec 08             	sub    $0x8,%esp
  return namex(path, 1, name);
80102582:	83 ec 04             	sub    $0x4,%esp
80102585:	ff 75 0c             	push   0xc(%ebp)
80102588:	6a 01                	push   $0x1
8010258a:	ff 75 08             	push   0x8(%ebp)
8010258d:	e8 af fe ff ff       	call   80102441 <namex>
80102592:	83 c4 10             	add    $0x10,%esp
}
80102595:	c9                   	leave  
80102596:	c3                   	ret    

80102597 <inb>:
{
80102597:	55                   	push   %ebp
80102598:	89 e5                	mov    %esp,%ebp
8010259a:	83 ec 14             	sub    $0x14,%esp
8010259d:	8b 45 08             	mov    0x8(%ebp),%eax
801025a0:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801025a4:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
801025a8:	89 c2                	mov    %eax,%edx
801025aa:	ec                   	in     (%dx),%al
801025ab:	88 45 ff             	mov    %al,-0x1(%ebp)
  return data;
801025ae:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
}
801025b2:	c9                   	leave  
801025b3:	c3                   	ret    

801025b4 <insl>:
{
801025b4:	55                   	push   %ebp
801025b5:	89 e5                	mov    %esp,%ebp
801025b7:	57                   	push   %edi
801025b8:	53                   	push   %ebx
  asm volatile("cld; rep insl" :
801025b9:	8b 55 08             	mov    0x8(%ebp),%edx
801025bc:	8b 4d 0c             	mov    0xc(%ebp),%ecx
801025bf:	8b 45 10             	mov    0x10(%ebp),%eax
801025c2:	89 cb                	mov    %ecx,%ebx
801025c4:	89 df                	mov    %ebx,%edi
801025c6:	89 c1                	mov    %eax,%ecx
801025c8:	fc                   	cld    
801025c9:	f3 6d                	rep insl (%dx),%es:(%edi)
801025cb:	89 c8                	mov    %ecx,%eax
801025cd:	89 fb                	mov    %edi,%ebx
801025cf:	89 5d 0c             	mov    %ebx,0xc(%ebp)
801025d2:	89 45 10             	mov    %eax,0x10(%ebp)
}
801025d5:	90                   	nop
801025d6:	5b                   	pop    %ebx
801025d7:	5f                   	pop    %edi
801025d8:	5d                   	pop    %ebp
801025d9:	c3                   	ret    

801025da <outb>:
{
801025da:	55                   	push   %ebp
801025db:	89 e5                	mov    %esp,%ebp
801025dd:	83 ec 08             	sub    $0x8,%esp
801025e0:	8b 45 08             	mov    0x8(%ebp),%eax
801025e3:	8b 55 0c             	mov    0xc(%ebp),%edx
801025e6:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
801025ea:	89 d0                	mov    %edx,%eax
801025ec:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801025ef:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
801025f3:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
801025f7:	ee                   	out    %al,(%dx)
}
801025f8:	90                   	nop
801025f9:	c9                   	leave  
801025fa:	c3                   	ret    

801025fb <outsl>:
{
801025fb:	55                   	push   %ebp
801025fc:	89 e5                	mov    %esp,%ebp
801025fe:	56                   	push   %esi
801025ff:	53                   	push   %ebx
  asm volatile("cld; rep outsl" :
80102600:	8b 55 08             	mov    0x8(%ebp),%edx
80102603:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80102606:	8b 45 10             	mov    0x10(%ebp),%eax
80102609:	89 cb                	mov    %ecx,%ebx
8010260b:	89 de                	mov    %ebx,%esi
8010260d:	89 c1                	mov    %eax,%ecx
8010260f:	fc                   	cld    
80102610:	f3 6f                	rep outsl %ds:(%esi),(%dx)
80102612:	89 c8                	mov    %ecx,%eax
80102614:	89 f3                	mov    %esi,%ebx
80102616:	89 5d 0c             	mov    %ebx,0xc(%ebp)
80102619:	89 45 10             	mov    %eax,0x10(%ebp)
}
8010261c:	90                   	nop
8010261d:	5b                   	pop    %ebx
8010261e:	5e                   	pop    %esi
8010261f:	5d                   	pop    %ebp
80102620:	c3                   	ret    

80102621 <idewait>:
static void idestart(struct buf*);

// Wait for IDE disk to become ready.
static int
idewait(int checkerr)
{
80102621:	55                   	push   %ebp
80102622:	89 e5                	mov    %esp,%ebp
80102624:	83 ec 10             	sub    $0x10,%esp
  int r;

  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80102627:	90                   	nop
80102628:	68 f7 01 00 00       	push   $0x1f7
8010262d:	e8 65 ff ff ff       	call   80102597 <inb>
80102632:	83 c4 04             	add    $0x4,%esp
80102635:	0f b6 c0             	movzbl %al,%eax
80102638:	89 45 fc             	mov    %eax,-0x4(%ebp)
8010263b:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010263e:	25 c0 00 00 00       	and    $0xc0,%eax
80102643:	83 f8 40             	cmp    $0x40,%eax
80102646:	75 e0                	jne    80102628 <idewait+0x7>
    ;
  if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
80102648:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010264c:	74 11                	je     8010265f <idewait+0x3e>
8010264e:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102651:	83 e0 21             	and    $0x21,%eax
80102654:	85 c0                	test   %eax,%eax
80102656:	74 07                	je     8010265f <idewait+0x3e>
    return -1;
80102658:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010265d:	eb 05                	jmp    80102664 <idewait+0x43>
  return 0;
8010265f:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102664:	c9                   	leave  
80102665:	c3                   	ret    

80102666 <ideinit>:

void
ideinit(void)
{
80102666:	55                   	push   %ebp
80102667:	89 e5                	mov    %esp,%ebp
80102669:	83 ec 18             	sub    $0x18,%esp
  int i;

  initlock(&idelock, "ide");
8010266c:	83 ec 08             	sub    $0x8,%esp
8010266f:	68 57 86 10 80       	push   $0x80108657
80102674:	68 40 26 11 80       	push   $0x80112640
80102679:	e8 1a 29 00 00       	call   80104f98 <initlock>
8010267e:	83 c4 10             	add    $0x10,%esp
  ioapicenable(IRQ_IDE, ncpu - 1);
80102681:	a1 60 2d 11 80       	mov    0x80112d60,%eax
80102686:	83 e8 01             	sub    $0x1,%eax
80102689:	83 ec 08             	sub    $0x8,%esp
8010268c:	50                   	push   %eax
8010268d:	6a 0e                	push   $0xe
8010268f:	e8 a3 04 00 00       	call   80102b37 <ioapicenable>
80102694:	83 c4 10             	add    $0x10,%esp
  idewait(0);
80102697:	83 ec 0c             	sub    $0xc,%esp
8010269a:	6a 00                	push   $0x0
8010269c:	e8 80 ff ff ff       	call   80102621 <idewait>
801026a1:	83 c4 10             	add    $0x10,%esp

  // Check if disk 1 is present
  outb(0x1f6, 0xe0 | (1<<4));
801026a4:	83 ec 08             	sub    $0x8,%esp
801026a7:	68 f0 00 00 00       	push   $0xf0
801026ac:	68 f6 01 00 00       	push   $0x1f6
801026b1:	e8 24 ff ff ff       	call   801025da <outb>
801026b6:	83 c4 10             	add    $0x10,%esp
  for(i=0; i<1000; i++){
801026b9:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801026c0:	eb 24                	jmp    801026e6 <ideinit+0x80>
    if(inb(0x1f7) != 0){
801026c2:	83 ec 0c             	sub    $0xc,%esp
801026c5:	68 f7 01 00 00       	push   $0x1f7
801026ca:	e8 c8 fe ff ff       	call   80102597 <inb>
801026cf:	83 c4 10             	add    $0x10,%esp
801026d2:	84 c0                	test   %al,%al
801026d4:	74 0c                	je     801026e2 <ideinit+0x7c>
      havedisk1 = 1;
801026d6:	c7 05 78 26 11 80 01 	movl   $0x1,0x80112678
801026dd:	00 00 00 
      break;
801026e0:	eb 0d                	jmp    801026ef <ideinit+0x89>
  for(i=0; i<1000; i++){
801026e2:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801026e6:	81 7d f4 e7 03 00 00 	cmpl   $0x3e7,-0xc(%ebp)
801026ed:	7e d3                	jle    801026c2 <ideinit+0x5c>
    }
  }

  // Switch back to disk 0.
  outb(0x1f6, 0xe0 | (0<<4));
801026ef:	83 ec 08             	sub    $0x8,%esp
801026f2:	68 e0 00 00 00       	push   $0xe0
801026f7:	68 f6 01 00 00       	push   $0x1f6
801026fc:	e8 d9 fe ff ff       	call   801025da <outb>
80102701:	83 c4 10             	add    $0x10,%esp
}
80102704:	90                   	nop
80102705:	c9                   	leave  
80102706:	c3                   	ret    

80102707 <idestart>:

// Start the request for b.  Caller must hold idelock.
static void
idestart(struct buf *b)
{
80102707:	55                   	push   %ebp
80102708:	89 e5                	mov    %esp,%ebp
8010270a:	83 ec 18             	sub    $0x18,%esp
  if(b == 0)
8010270d:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80102711:	75 0d                	jne    80102720 <idestart+0x19>
    panic("idestart");
80102713:	83 ec 0c             	sub    $0xc,%esp
80102716:	68 5b 86 10 80       	push   $0x8010865b
8010271b:	e8 95 de ff ff       	call   801005b5 <panic>
  if(b->blockno >= FSSIZE)
80102720:	8b 45 08             	mov    0x8(%ebp),%eax
80102723:	8b 40 08             	mov    0x8(%eax),%eax
80102726:	3d e7 03 00 00       	cmp    $0x3e7,%eax
8010272b:	76 0d                	jbe    8010273a <idestart+0x33>
    panic("incorrect blockno");
8010272d:	83 ec 0c             	sub    $0xc,%esp
80102730:	68 64 86 10 80       	push   $0x80108664
80102735:	e8 7b de ff ff       	call   801005b5 <panic>
  int sector_per_block =  BSIZE/SECTOR_SIZE;
8010273a:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
  int sector = b->blockno * sector_per_block;
80102741:	8b 45 08             	mov    0x8(%ebp),%eax
80102744:	8b 50 08             	mov    0x8(%eax),%edx
80102747:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010274a:	0f af c2             	imul   %edx,%eax
8010274d:	89 45 f0             	mov    %eax,-0x10(%ebp)
  int read_cmd = (sector_per_block == 1) ? IDE_CMD_READ :  IDE_CMD_RDMUL;
80102750:	83 7d f4 01          	cmpl   $0x1,-0xc(%ebp)
80102754:	75 07                	jne    8010275d <idestart+0x56>
80102756:	b8 20 00 00 00       	mov    $0x20,%eax
8010275b:	eb 05                	jmp    80102762 <idestart+0x5b>
8010275d:	b8 c4 00 00 00       	mov    $0xc4,%eax
80102762:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int write_cmd = (sector_per_block == 1) ? IDE_CMD_WRITE : IDE_CMD_WRMUL;
80102765:	83 7d f4 01          	cmpl   $0x1,-0xc(%ebp)
80102769:	75 07                	jne    80102772 <idestart+0x6b>
8010276b:	b8 30 00 00 00       	mov    $0x30,%eax
80102770:	eb 05                	jmp    80102777 <idestart+0x70>
80102772:	b8 c5 00 00 00       	mov    $0xc5,%eax
80102777:	89 45 e8             	mov    %eax,-0x18(%ebp)

  if (sector_per_block > 7) panic("idestart");
8010277a:	83 7d f4 07          	cmpl   $0x7,-0xc(%ebp)
8010277e:	7e 0d                	jle    8010278d <idestart+0x86>
80102780:	83 ec 0c             	sub    $0xc,%esp
80102783:	68 5b 86 10 80       	push   $0x8010865b
80102788:	e8 28 de ff ff       	call   801005b5 <panic>

  idewait(0);
8010278d:	83 ec 0c             	sub    $0xc,%esp
80102790:	6a 00                	push   $0x0
80102792:	e8 8a fe ff ff       	call   80102621 <idewait>
80102797:	83 c4 10             	add    $0x10,%esp
  outb(0x3f6, 0);  // generate interrupt
8010279a:	83 ec 08             	sub    $0x8,%esp
8010279d:	6a 00                	push   $0x0
8010279f:	68 f6 03 00 00       	push   $0x3f6
801027a4:	e8 31 fe ff ff       	call   801025da <outb>
801027a9:	83 c4 10             	add    $0x10,%esp
  outb(0x1f2, sector_per_block);  // number of sectors
801027ac:	8b 45 f4             	mov    -0xc(%ebp),%eax
801027af:	0f b6 c0             	movzbl %al,%eax
801027b2:	83 ec 08             	sub    $0x8,%esp
801027b5:	50                   	push   %eax
801027b6:	68 f2 01 00 00       	push   $0x1f2
801027bb:	e8 1a fe ff ff       	call   801025da <outb>
801027c0:	83 c4 10             	add    $0x10,%esp
  outb(0x1f3, sector & 0xff);
801027c3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801027c6:	0f b6 c0             	movzbl %al,%eax
801027c9:	83 ec 08             	sub    $0x8,%esp
801027cc:	50                   	push   %eax
801027cd:	68 f3 01 00 00       	push   $0x1f3
801027d2:	e8 03 fe ff ff       	call   801025da <outb>
801027d7:	83 c4 10             	add    $0x10,%esp
  outb(0x1f4, (sector >> 8) & 0xff);
801027da:	8b 45 f0             	mov    -0x10(%ebp),%eax
801027dd:	c1 f8 08             	sar    $0x8,%eax
801027e0:	0f b6 c0             	movzbl %al,%eax
801027e3:	83 ec 08             	sub    $0x8,%esp
801027e6:	50                   	push   %eax
801027e7:	68 f4 01 00 00       	push   $0x1f4
801027ec:	e8 e9 fd ff ff       	call   801025da <outb>
801027f1:	83 c4 10             	add    $0x10,%esp
  outb(0x1f5, (sector >> 16) & 0xff);
801027f4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801027f7:	c1 f8 10             	sar    $0x10,%eax
801027fa:	0f b6 c0             	movzbl %al,%eax
801027fd:	83 ec 08             	sub    $0x8,%esp
80102800:	50                   	push   %eax
80102801:	68 f5 01 00 00       	push   $0x1f5
80102806:	e8 cf fd ff ff       	call   801025da <outb>
8010280b:	83 c4 10             	add    $0x10,%esp
  outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
8010280e:	8b 45 08             	mov    0x8(%ebp),%eax
80102811:	8b 40 04             	mov    0x4(%eax),%eax
80102814:	c1 e0 04             	shl    $0x4,%eax
80102817:	83 e0 10             	and    $0x10,%eax
8010281a:	89 c2                	mov    %eax,%edx
8010281c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010281f:	c1 f8 18             	sar    $0x18,%eax
80102822:	83 e0 0f             	and    $0xf,%eax
80102825:	09 d0                	or     %edx,%eax
80102827:	83 c8 e0             	or     $0xffffffe0,%eax
8010282a:	0f b6 c0             	movzbl %al,%eax
8010282d:	83 ec 08             	sub    $0x8,%esp
80102830:	50                   	push   %eax
80102831:	68 f6 01 00 00       	push   $0x1f6
80102836:	e8 9f fd ff ff       	call   801025da <outb>
8010283b:	83 c4 10             	add    $0x10,%esp
  if(b->flags & B_DIRTY){
8010283e:	8b 45 08             	mov    0x8(%ebp),%eax
80102841:	8b 00                	mov    (%eax),%eax
80102843:	83 e0 04             	and    $0x4,%eax
80102846:	85 c0                	test   %eax,%eax
80102848:	74 35                	je     8010287f <idestart+0x178>
    outb(0x1f7, write_cmd);
8010284a:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010284d:	0f b6 c0             	movzbl %al,%eax
80102850:	83 ec 08             	sub    $0x8,%esp
80102853:	50                   	push   %eax
80102854:	68 f7 01 00 00       	push   $0x1f7
80102859:	e8 7c fd ff ff       	call   801025da <outb>
8010285e:	83 c4 10             	add    $0x10,%esp
    outsl(0x1f0, b->data, BSIZE/4);
80102861:	8b 45 08             	mov    0x8(%ebp),%eax
80102864:	83 c0 5c             	add    $0x5c,%eax
80102867:	83 ec 04             	sub    $0x4,%esp
8010286a:	68 80 00 00 00       	push   $0x80
8010286f:	50                   	push   %eax
80102870:	68 f0 01 00 00       	push   $0x1f0
80102875:	e8 81 fd ff ff       	call   801025fb <outsl>
8010287a:	83 c4 10             	add    $0x10,%esp
  } else {
    outb(0x1f7, read_cmd);
  }
}
8010287d:	eb 17                	jmp    80102896 <idestart+0x18f>
    outb(0x1f7, read_cmd);
8010287f:	8b 45 ec             	mov    -0x14(%ebp),%eax
80102882:	0f b6 c0             	movzbl %al,%eax
80102885:	83 ec 08             	sub    $0x8,%esp
80102888:	50                   	push   %eax
80102889:	68 f7 01 00 00       	push   $0x1f7
8010288e:	e8 47 fd ff ff       	call   801025da <outb>
80102893:	83 c4 10             	add    $0x10,%esp
}
80102896:	90                   	nop
80102897:	c9                   	leave  
80102898:	c3                   	ret    

80102899 <ideintr>:

// Interrupt handler.
void
ideintr(void)
{
80102899:	55                   	push   %ebp
8010289a:	89 e5                	mov    %esp,%ebp
8010289c:	83 ec 18             	sub    $0x18,%esp
  struct buf *b;

  // First queued buffer is the active request.
  acquire(&idelock);
8010289f:	83 ec 0c             	sub    $0xc,%esp
801028a2:	68 40 26 11 80       	push   $0x80112640
801028a7:	e8 0e 27 00 00       	call   80104fba <acquire>
801028ac:	83 c4 10             	add    $0x10,%esp

  if((b = idequeue) == 0){
801028af:	a1 74 26 11 80       	mov    0x80112674,%eax
801028b4:	89 45 f4             	mov    %eax,-0xc(%ebp)
801028b7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801028bb:	75 15                	jne    801028d2 <ideintr+0x39>
    release(&idelock);
801028bd:	83 ec 0c             	sub    $0xc,%esp
801028c0:	68 40 26 11 80       	push   $0x80112640
801028c5:	e8 5e 27 00 00       	call   80105028 <release>
801028ca:	83 c4 10             	add    $0x10,%esp
    return;
801028cd:	e9 9a 00 00 00       	jmp    8010296c <ideintr+0xd3>
  }
  idequeue = b->qnext;
801028d2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801028d5:	8b 40 58             	mov    0x58(%eax),%eax
801028d8:	a3 74 26 11 80       	mov    %eax,0x80112674

  // Read data if needed.
  if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
801028dd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801028e0:	8b 00                	mov    (%eax),%eax
801028e2:	83 e0 04             	and    $0x4,%eax
801028e5:	85 c0                	test   %eax,%eax
801028e7:	75 2d                	jne    80102916 <ideintr+0x7d>
801028e9:	83 ec 0c             	sub    $0xc,%esp
801028ec:	6a 01                	push   $0x1
801028ee:	e8 2e fd ff ff       	call   80102621 <idewait>
801028f3:	83 c4 10             	add    $0x10,%esp
801028f6:	85 c0                	test   %eax,%eax
801028f8:	78 1c                	js     80102916 <ideintr+0x7d>
    insl(0x1f0, b->data, BSIZE/4);
801028fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801028fd:	83 c0 5c             	add    $0x5c,%eax
80102900:	83 ec 04             	sub    $0x4,%esp
80102903:	68 80 00 00 00       	push   $0x80
80102908:	50                   	push   %eax
80102909:	68 f0 01 00 00       	push   $0x1f0
8010290e:	e8 a1 fc ff ff       	call   801025b4 <insl>
80102913:	83 c4 10             	add    $0x10,%esp

  // Wake process waiting for this buf.
  b->flags |= B_VALID;
80102916:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102919:	8b 00                	mov    (%eax),%eax
8010291b:	83 c8 02             	or     $0x2,%eax
8010291e:	89 c2                	mov    %eax,%edx
80102920:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102923:	89 10                	mov    %edx,(%eax)
  b->flags &= ~B_DIRTY;
80102925:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102928:	8b 00                	mov    (%eax),%eax
8010292a:	83 e0 fb             	and    $0xfffffffb,%eax
8010292d:	89 c2                	mov    %eax,%edx
8010292f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102932:	89 10                	mov    %edx,(%eax)
  wakeup(b);
80102934:	83 ec 0c             	sub    $0xc,%esp
80102937:	ff 75 f4             	push   -0xc(%ebp)
8010293a:	e8 47 23 00 00       	call   80104c86 <wakeup>
8010293f:	83 c4 10             	add    $0x10,%esp

  // Start disk on next buf in queue.
  if(idequeue != 0)
80102942:	a1 74 26 11 80       	mov    0x80112674,%eax
80102947:	85 c0                	test   %eax,%eax
80102949:	74 11                	je     8010295c <ideintr+0xc3>
    idestart(idequeue);
8010294b:	a1 74 26 11 80       	mov    0x80112674,%eax
80102950:	83 ec 0c             	sub    $0xc,%esp
80102953:	50                   	push   %eax
80102954:	e8 ae fd ff ff       	call   80102707 <idestart>
80102959:	83 c4 10             	add    $0x10,%esp

  release(&idelock);
8010295c:	83 ec 0c             	sub    $0xc,%esp
8010295f:	68 40 26 11 80       	push   $0x80112640
80102964:	e8 bf 26 00 00       	call   80105028 <release>
80102969:	83 c4 10             	add    $0x10,%esp
}
8010296c:	c9                   	leave  
8010296d:	c3                   	ret    

8010296e <iderw>:
// Sync buf with disk.
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
8010296e:	55                   	push   %ebp
8010296f:	89 e5                	mov    %esp,%ebp
80102971:	83 ec 18             	sub    $0x18,%esp
  struct buf **pp;

  if(!holdingsleep(&b->lock))
80102974:	8b 45 08             	mov    0x8(%ebp),%eax
80102977:	83 c0 0c             	add    $0xc,%eax
8010297a:	83 ec 0c             	sub    $0xc,%esp
8010297d:	50                   	push   %eax
8010297e:	e8 a6 25 00 00       	call   80104f29 <holdingsleep>
80102983:	83 c4 10             	add    $0x10,%esp
80102986:	85 c0                	test   %eax,%eax
80102988:	75 0d                	jne    80102997 <iderw+0x29>
    panic("iderw: buf not locked");
8010298a:	83 ec 0c             	sub    $0xc,%esp
8010298d:	68 76 86 10 80       	push   $0x80108676
80102992:	e8 1e dc ff ff       	call   801005b5 <panic>
  if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
80102997:	8b 45 08             	mov    0x8(%ebp),%eax
8010299a:	8b 00                	mov    (%eax),%eax
8010299c:	83 e0 06             	and    $0x6,%eax
8010299f:	83 f8 02             	cmp    $0x2,%eax
801029a2:	75 0d                	jne    801029b1 <iderw+0x43>
    panic("iderw: nothing to do");
801029a4:	83 ec 0c             	sub    $0xc,%esp
801029a7:	68 8c 86 10 80       	push   $0x8010868c
801029ac:	e8 04 dc ff ff       	call   801005b5 <panic>
  if(b->dev != 0 && !havedisk1)
801029b1:	8b 45 08             	mov    0x8(%ebp),%eax
801029b4:	8b 40 04             	mov    0x4(%eax),%eax
801029b7:	85 c0                	test   %eax,%eax
801029b9:	74 16                	je     801029d1 <iderw+0x63>
801029bb:	a1 78 26 11 80       	mov    0x80112678,%eax
801029c0:	85 c0                	test   %eax,%eax
801029c2:	75 0d                	jne    801029d1 <iderw+0x63>
    panic("iderw: ide disk 1 not present");
801029c4:	83 ec 0c             	sub    $0xc,%esp
801029c7:	68 a1 86 10 80       	push   $0x801086a1
801029cc:	e8 e4 db ff ff       	call   801005b5 <panic>

  acquire(&idelock);  //DOC:acquire-lock
801029d1:	83 ec 0c             	sub    $0xc,%esp
801029d4:	68 40 26 11 80       	push   $0x80112640
801029d9:	e8 dc 25 00 00       	call   80104fba <acquire>
801029de:	83 c4 10             	add    $0x10,%esp

  // Append b to idequeue.
  b->qnext = 0;
801029e1:	8b 45 08             	mov    0x8(%ebp),%eax
801029e4:	c7 40 58 00 00 00 00 	movl   $0x0,0x58(%eax)
  for(pp=&idequeue; *pp; pp=&(*pp)->qnext)  //DOC:insert-queue
801029eb:	c7 45 f4 74 26 11 80 	movl   $0x80112674,-0xc(%ebp)
801029f2:	eb 0b                	jmp    801029ff <iderw+0x91>
801029f4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801029f7:	8b 00                	mov    (%eax),%eax
801029f9:	83 c0 58             	add    $0x58,%eax
801029fc:	89 45 f4             	mov    %eax,-0xc(%ebp)
801029ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102a02:	8b 00                	mov    (%eax),%eax
80102a04:	85 c0                	test   %eax,%eax
80102a06:	75 ec                	jne    801029f4 <iderw+0x86>
    ;
  *pp = b;
80102a08:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102a0b:	8b 55 08             	mov    0x8(%ebp),%edx
80102a0e:	89 10                	mov    %edx,(%eax)

  // Start disk if necessary.
  if(idequeue == b)
80102a10:	a1 74 26 11 80       	mov    0x80112674,%eax
80102a15:	39 45 08             	cmp    %eax,0x8(%ebp)
80102a18:	75 23                	jne    80102a3d <iderw+0xcf>
    idestart(b);
80102a1a:	83 ec 0c             	sub    $0xc,%esp
80102a1d:	ff 75 08             	push   0x8(%ebp)
80102a20:	e8 e2 fc ff ff       	call   80102707 <idestart>
80102a25:	83 c4 10             	add    $0x10,%esp

  // Wait for request to finish.
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102a28:	eb 13                	jmp    80102a3d <iderw+0xcf>
    sleep(b, &idelock);
80102a2a:	83 ec 08             	sub    $0x8,%esp
80102a2d:	68 40 26 11 80       	push   $0x80112640
80102a32:	ff 75 08             	push   0x8(%ebp)
80102a35:	e8 65 21 00 00       	call   80104b9f <sleep>
80102a3a:	83 c4 10             	add    $0x10,%esp
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102a3d:	8b 45 08             	mov    0x8(%ebp),%eax
80102a40:	8b 00                	mov    (%eax),%eax
80102a42:	83 e0 06             	and    $0x6,%eax
80102a45:	83 f8 02             	cmp    $0x2,%eax
80102a48:	75 e0                	jne    80102a2a <iderw+0xbc>
  }


  release(&idelock);
80102a4a:	83 ec 0c             	sub    $0xc,%esp
80102a4d:	68 40 26 11 80       	push   $0x80112640
80102a52:	e8 d1 25 00 00       	call   80105028 <release>
80102a57:	83 c4 10             	add    $0x10,%esp
}
80102a5a:	90                   	nop
80102a5b:	c9                   	leave  
80102a5c:	c3                   	ret    

80102a5d <ioapicread>:
  uint data;
};

static uint
ioapicread(int reg)
{
80102a5d:	55                   	push   %ebp
80102a5e:	89 e5                	mov    %esp,%ebp
  ioapic->reg = reg;
80102a60:	a1 7c 26 11 80       	mov    0x8011267c,%eax
80102a65:	8b 55 08             	mov    0x8(%ebp),%edx
80102a68:	89 10                	mov    %edx,(%eax)
  return ioapic->data;
80102a6a:	a1 7c 26 11 80       	mov    0x8011267c,%eax
80102a6f:	8b 40 10             	mov    0x10(%eax),%eax
}
80102a72:	5d                   	pop    %ebp
80102a73:	c3                   	ret    

80102a74 <ioapicwrite>:

static void
ioapicwrite(int reg, uint data)
{
80102a74:	55                   	push   %ebp
80102a75:	89 e5                	mov    %esp,%ebp
  ioapic->reg = reg;
80102a77:	a1 7c 26 11 80       	mov    0x8011267c,%eax
80102a7c:	8b 55 08             	mov    0x8(%ebp),%edx
80102a7f:	89 10                	mov    %edx,(%eax)
  ioapic->data = data;
80102a81:	a1 7c 26 11 80       	mov    0x8011267c,%eax
80102a86:	8b 55 0c             	mov    0xc(%ebp),%edx
80102a89:	89 50 10             	mov    %edx,0x10(%eax)
}
80102a8c:	90                   	nop
80102a8d:	5d                   	pop    %ebp
80102a8e:	c3                   	ret    

80102a8f <ioapicinit>:

void
ioapicinit(void)
{
80102a8f:	55                   	push   %ebp
80102a90:	89 e5                	mov    %esp,%ebp
80102a92:	83 ec 18             	sub    $0x18,%esp
  int i, id, maxintr;

  ioapic = (volatile struct ioapic*)IOAPIC;
80102a95:	c7 05 7c 26 11 80 00 	movl   $0xfec00000,0x8011267c
80102a9c:	00 c0 fe 
  maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
80102a9f:	6a 01                	push   $0x1
80102aa1:	e8 b7 ff ff ff       	call   80102a5d <ioapicread>
80102aa6:	83 c4 04             	add    $0x4,%esp
80102aa9:	c1 e8 10             	shr    $0x10,%eax
80102aac:	25 ff 00 00 00       	and    $0xff,%eax
80102ab1:	89 45 f0             	mov    %eax,-0x10(%ebp)
  id = ioapicread(REG_ID) >> 24;
80102ab4:	6a 00                	push   $0x0
80102ab6:	e8 a2 ff ff ff       	call   80102a5d <ioapicread>
80102abb:	83 c4 04             	add    $0x4,%esp
80102abe:	c1 e8 18             	shr    $0x18,%eax
80102ac1:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if(id != ioapicid)
80102ac4:	0f b6 05 64 2d 11 80 	movzbl 0x80112d64,%eax
80102acb:	0f b6 c0             	movzbl %al,%eax
80102ace:	39 45 ec             	cmp    %eax,-0x14(%ebp)
80102ad1:	74 10                	je     80102ae3 <ioapicinit+0x54>
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102ad3:	83 ec 0c             	sub    $0xc,%esp
80102ad6:	68 c0 86 10 80       	push   $0x801086c0
80102adb:	e8 20 d9 ff ff       	call   80100400 <cprintf>
80102ae0:	83 c4 10             	add    $0x10,%esp

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
80102ae3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80102aea:	eb 3f                	jmp    80102b2b <ioapicinit+0x9c>
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
80102aec:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102aef:	83 c0 20             	add    $0x20,%eax
80102af2:	0d 00 00 01 00       	or     $0x10000,%eax
80102af7:	89 c2                	mov    %eax,%edx
80102af9:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102afc:	83 c0 08             	add    $0x8,%eax
80102aff:	01 c0                	add    %eax,%eax
80102b01:	83 ec 08             	sub    $0x8,%esp
80102b04:	52                   	push   %edx
80102b05:	50                   	push   %eax
80102b06:	e8 69 ff ff ff       	call   80102a74 <ioapicwrite>
80102b0b:	83 c4 10             	add    $0x10,%esp
    ioapicwrite(REG_TABLE+2*i+1, 0);
80102b0e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b11:	83 c0 08             	add    $0x8,%eax
80102b14:	01 c0                	add    %eax,%eax
80102b16:	83 c0 01             	add    $0x1,%eax
80102b19:	83 ec 08             	sub    $0x8,%esp
80102b1c:	6a 00                	push   $0x0
80102b1e:	50                   	push   %eax
80102b1f:	e8 50 ff ff ff       	call   80102a74 <ioapicwrite>
80102b24:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i <= maxintr; i++){
80102b27:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80102b2b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b2e:	3b 45 f0             	cmp    -0x10(%ebp),%eax
80102b31:	7e b9                	jle    80102aec <ioapicinit+0x5d>
  }
}
80102b33:	90                   	nop
80102b34:	90                   	nop
80102b35:	c9                   	leave  
80102b36:	c3                   	ret    

80102b37 <ioapicenable>:

void
ioapicenable(int irq, int cpunum)
{
80102b37:	55                   	push   %ebp
80102b38:	89 e5                	mov    %esp,%ebp
  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
80102b3a:	8b 45 08             	mov    0x8(%ebp),%eax
80102b3d:	83 c0 20             	add    $0x20,%eax
80102b40:	89 c2                	mov    %eax,%edx
80102b42:	8b 45 08             	mov    0x8(%ebp),%eax
80102b45:	83 c0 08             	add    $0x8,%eax
80102b48:	01 c0                	add    %eax,%eax
80102b4a:	52                   	push   %edx
80102b4b:	50                   	push   %eax
80102b4c:	e8 23 ff ff ff       	call   80102a74 <ioapicwrite>
80102b51:	83 c4 08             	add    $0x8,%esp
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
80102b54:	8b 45 0c             	mov    0xc(%ebp),%eax
80102b57:	c1 e0 18             	shl    $0x18,%eax
80102b5a:	89 c2                	mov    %eax,%edx
80102b5c:	8b 45 08             	mov    0x8(%ebp),%eax
80102b5f:	83 c0 08             	add    $0x8,%eax
80102b62:	01 c0                	add    %eax,%eax
80102b64:	83 c0 01             	add    $0x1,%eax
80102b67:	52                   	push   %edx
80102b68:	50                   	push   %eax
80102b69:	e8 06 ff ff ff       	call   80102a74 <ioapicwrite>
80102b6e:	83 c4 08             	add    $0x8,%esp
}
80102b71:	90                   	nop
80102b72:	c9                   	leave  
80102b73:	c3                   	ret    

80102b74 <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
80102b74:	55                   	push   %ebp
80102b75:	89 e5                	mov    %esp,%ebp
80102b77:	83 ec 08             	sub    $0x8,%esp
  initlock(&kmem.lock, "kmem");
80102b7a:	83 ec 08             	sub    $0x8,%esp
80102b7d:	68 f2 86 10 80       	push   $0x801086f2
80102b82:	68 a0 26 11 80       	push   $0x801126a0
80102b87:	e8 0c 24 00 00       	call   80104f98 <initlock>
80102b8c:	83 c4 10             	add    $0x10,%esp
  kmem.use_lock = 0;
80102b8f:	c7 05 d4 26 11 80 00 	movl   $0x0,0x801126d4
80102b96:	00 00 00 
  freerange(vstart, vend);
80102b99:	83 ec 08             	sub    $0x8,%esp
80102b9c:	ff 75 0c             	push   0xc(%ebp)
80102b9f:	ff 75 08             	push   0x8(%ebp)
80102ba2:	e8 2a 00 00 00       	call   80102bd1 <freerange>
80102ba7:	83 c4 10             	add    $0x10,%esp
}
80102baa:	90                   	nop
80102bab:	c9                   	leave  
80102bac:	c3                   	ret    

80102bad <kinit2>:

void
kinit2(void *vstart, void *vend)
{
80102bad:	55                   	push   %ebp
80102bae:	89 e5                	mov    %esp,%ebp
80102bb0:	83 ec 08             	sub    $0x8,%esp
  freerange(vstart, vend);
80102bb3:	83 ec 08             	sub    $0x8,%esp
80102bb6:	ff 75 0c             	push   0xc(%ebp)
80102bb9:	ff 75 08             	push   0x8(%ebp)
80102bbc:	e8 10 00 00 00       	call   80102bd1 <freerange>
80102bc1:	83 c4 10             	add    $0x10,%esp
  kmem.use_lock = 1;
80102bc4:	c7 05 d4 26 11 80 01 	movl   $0x1,0x801126d4
80102bcb:	00 00 00 
}
80102bce:	90                   	nop
80102bcf:	c9                   	leave  
80102bd0:	c3                   	ret    

80102bd1 <freerange>:

void
freerange(void *vstart, void *vend)
{
80102bd1:	55                   	push   %ebp
80102bd2:	89 e5                	mov    %esp,%ebp
80102bd4:	83 ec 18             	sub    $0x18,%esp
  char *p;
  p = (char*)PGROUNDUP((uint)vstart);
80102bd7:	8b 45 08             	mov    0x8(%ebp),%eax
80102bda:	05 ff 0f 00 00       	add    $0xfff,%eax
80102bdf:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80102be4:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102be7:	eb 15                	jmp    80102bfe <freerange+0x2d>
    kfree(p);
80102be9:	83 ec 0c             	sub    $0xc,%esp
80102bec:	ff 75 f4             	push   -0xc(%ebp)
80102bef:	e8 1b 00 00 00       	call   80102c0f <kfree>
80102bf4:	83 c4 10             	add    $0x10,%esp
  for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102bf7:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80102bfe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102c01:	05 00 10 00 00       	add    $0x1000,%eax
80102c06:	39 45 0c             	cmp    %eax,0xc(%ebp)
80102c09:	73 de                	jae    80102be9 <freerange+0x18>
}
80102c0b:	90                   	nop
80102c0c:	90                   	nop
80102c0d:	c9                   	leave  
80102c0e:	c3                   	ret    

80102c0f <kfree>:
// which normally should have been returned by a
// call to kalloc().  (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
80102c0f:	55                   	push   %ebp
80102c10:	89 e5                	mov    %esp,%ebp
80102c12:	83 ec 18             	sub    $0x18,%esp
  struct run *r;

  if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
80102c15:	8b 45 08             	mov    0x8(%ebp),%eax
80102c18:	25 ff 0f 00 00       	and    $0xfff,%eax
80102c1d:	85 c0                	test   %eax,%eax
80102c1f:	75 18                	jne    80102c39 <kfree+0x2a>
80102c21:	81 7d 08 00 65 11 80 	cmpl   $0x80116500,0x8(%ebp)
80102c28:	72 0f                	jb     80102c39 <kfree+0x2a>
80102c2a:	8b 45 08             	mov    0x8(%ebp),%eax
80102c2d:	05 00 00 00 80       	add    $0x80000000,%eax
80102c32:	3d ff ff ff 0d       	cmp    $0xdffffff,%eax
80102c37:	76 0d                	jbe    80102c46 <kfree+0x37>
    panic("kfree");
80102c39:	83 ec 0c             	sub    $0xc,%esp
80102c3c:	68 f7 86 10 80       	push   $0x801086f7
80102c41:	e8 6f d9 ff ff       	call   801005b5 <panic>

  // Fill with junk to catch dangling refs.
  memset(v, 1, PGSIZE);
80102c46:	83 ec 04             	sub    $0x4,%esp
80102c49:	68 00 10 00 00       	push   $0x1000
80102c4e:	6a 01                	push   $0x1
80102c50:	ff 75 08             	push   0x8(%ebp)
80102c53:	e8 d8 25 00 00       	call   80105230 <memset>
80102c58:	83 c4 10             	add    $0x10,%esp

  if(kmem.use_lock)
80102c5b:	a1 d4 26 11 80       	mov    0x801126d4,%eax
80102c60:	85 c0                	test   %eax,%eax
80102c62:	74 10                	je     80102c74 <kfree+0x65>
    acquire(&kmem.lock);
80102c64:	83 ec 0c             	sub    $0xc,%esp
80102c67:	68 a0 26 11 80       	push   $0x801126a0
80102c6c:	e8 49 23 00 00       	call   80104fba <acquire>
80102c71:	83 c4 10             	add    $0x10,%esp
  r = (struct run*)v;
80102c74:	8b 45 08             	mov    0x8(%ebp),%eax
80102c77:	89 45 f4             	mov    %eax,-0xc(%ebp)
  r->next = kmem.freelist;
80102c7a:	8b 15 d8 26 11 80    	mov    0x801126d8,%edx
80102c80:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102c83:	89 10                	mov    %edx,(%eax)
  kmem.freelist = r;
80102c85:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102c88:	a3 d8 26 11 80       	mov    %eax,0x801126d8
  free_frame_cnt++;
80102c8d:	a1 80 26 11 80       	mov    0x80112680,%eax
80102c92:	83 c0 01             	add    $0x1,%eax
80102c95:	a3 80 26 11 80       	mov    %eax,0x80112680
  if(kmem.use_lock)
80102c9a:	a1 d4 26 11 80       	mov    0x801126d4,%eax
80102c9f:	85 c0                	test   %eax,%eax
80102ca1:	74 10                	je     80102cb3 <kfree+0xa4>
    release(&kmem.lock);
80102ca3:	83 ec 0c             	sub    $0xc,%esp
80102ca6:	68 a0 26 11 80       	push   $0x801126a0
80102cab:	e8 78 23 00 00       	call   80105028 <release>
80102cb0:	83 c4 10             	add    $0x10,%esp
}
80102cb3:	90                   	nop
80102cb4:	c9                   	leave  
80102cb5:	c3                   	ret    

80102cb6 <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
80102cb6:	55                   	push   %ebp
80102cb7:	89 e5                	mov    %esp,%ebp
80102cb9:	83 ec 18             	sub    $0x18,%esp
  struct run *r;

  if(kmem.use_lock)
80102cbc:	a1 d4 26 11 80       	mov    0x801126d4,%eax
80102cc1:	85 c0                	test   %eax,%eax
80102cc3:	74 10                	je     80102cd5 <kalloc+0x1f>
    acquire(&kmem.lock);
80102cc5:	83 ec 0c             	sub    $0xc,%esp
80102cc8:	68 a0 26 11 80       	push   $0x801126a0
80102ccd:	e8 e8 22 00 00       	call   80104fba <acquire>
80102cd2:	83 c4 10             	add    $0x10,%esp
  r = kmem.freelist;
80102cd5:	a1 d8 26 11 80       	mov    0x801126d8,%eax
80102cda:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(r){
80102cdd:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80102ce1:	74 17                	je     80102cfa <kalloc+0x44>
    kmem.freelist = r->next;
80102ce3:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102ce6:	8b 00                	mov    (%eax),%eax
80102ce8:	a3 d8 26 11 80       	mov    %eax,0x801126d8
    free_frame_cnt--;
80102ced:	a1 80 26 11 80       	mov    0x80112680,%eax
80102cf2:	83 e8 01             	sub    $0x1,%eax
80102cf5:	a3 80 26 11 80       	mov    %eax,0x80112680
  }
  if(kmem.use_lock)
80102cfa:	a1 d4 26 11 80       	mov    0x801126d4,%eax
80102cff:	85 c0                	test   %eax,%eax
80102d01:	74 10                	je     80102d13 <kalloc+0x5d>
    release(&kmem.lock);
80102d03:	83 ec 0c             	sub    $0xc,%esp
80102d06:	68 a0 26 11 80       	push   $0x801126a0
80102d0b:	e8 18 23 00 00       	call   80105028 <release>
80102d10:	83 c4 10             	add    $0x10,%esp
  return (char*)r;
80102d13:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80102d16:	c9                   	leave  
80102d17:	c3                   	ret    

80102d18 <inb>:
{
80102d18:	55                   	push   %ebp
80102d19:	89 e5                	mov    %esp,%ebp
80102d1b:	83 ec 14             	sub    $0x14,%esp
80102d1e:	8b 45 08             	mov    0x8(%ebp),%eax
80102d21:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102d25:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
80102d29:	89 c2                	mov    %eax,%edx
80102d2b:	ec                   	in     (%dx),%al
80102d2c:	88 45 ff             	mov    %al,-0x1(%ebp)
  return data;
80102d2f:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
}
80102d33:	c9                   	leave  
80102d34:	c3                   	ret    

80102d35 <kbdgetc>:
#include "defs.h"
#include "kbd.h"

int
kbdgetc(void)
{
80102d35:	55                   	push   %ebp
80102d36:	89 e5                	mov    %esp,%ebp
80102d38:	83 ec 10             	sub    $0x10,%esp
  static uchar *charcode[4] = {
    normalmap, shiftmap, ctlmap, ctlmap
  };
  uint st, data, c;

  st = inb(KBSTATP);
80102d3b:	6a 64                	push   $0x64
80102d3d:	e8 d6 ff ff ff       	call   80102d18 <inb>
80102d42:	83 c4 04             	add    $0x4,%esp
80102d45:	0f b6 c0             	movzbl %al,%eax
80102d48:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((st & KBS_DIB) == 0)
80102d4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102d4e:	83 e0 01             	and    $0x1,%eax
80102d51:	85 c0                	test   %eax,%eax
80102d53:	75 0a                	jne    80102d5f <kbdgetc+0x2a>
    return -1;
80102d55:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80102d5a:	e9 23 01 00 00       	jmp    80102e82 <kbdgetc+0x14d>
  data = inb(KBDATAP);
80102d5f:	6a 60                	push   $0x60
80102d61:	e8 b2 ff ff ff       	call   80102d18 <inb>
80102d66:	83 c4 04             	add    $0x4,%esp
80102d69:	0f b6 c0             	movzbl %al,%eax
80102d6c:	89 45 fc             	mov    %eax,-0x4(%ebp)

  if(data == 0xE0){
80102d6f:	81 7d fc e0 00 00 00 	cmpl   $0xe0,-0x4(%ebp)
80102d76:	75 17                	jne    80102d8f <kbdgetc+0x5a>
    shift |= E0ESC;
80102d78:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102d7d:	83 c8 40             	or     $0x40,%eax
80102d80:	a3 dc 26 11 80       	mov    %eax,0x801126dc
    return 0;
80102d85:	b8 00 00 00 00       	mov    $0x0,%eax
80102d8a:	e9 f3 00 00 00       	jmp    80102e82 <kbdgetc+0x14d>
  } else if(data & 0x80){
80102d8f:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102d92:	25 80 00 00 00       	and    $0x80,%eax
80102d97:	85 c0                	test   %eax,%eax
80102d99:	74 45                	je     80102de0 <kbdgetc+0xab>
    // Key released
    data = (shift & E0ESC ? data : data & 0x7F);
80102d9b:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102da0:	83 e0 40             	and    $0x40,%eax
80102da3:	85 c0                	test   %eax,%eax
80102da5:	75 08                	jne    80102daf <kbdgetc+0x7a>
80102da7:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102daa:	83 e0 7f             	and    $0x7f,%eax
80102dad:	eb 03                	jmp    80102db2 <kbdgetc+0x7d>
80102daf:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102db2:	89 45 fc             	mov    %eax,-0x4(%ebp)
    shift &= ~(shiftcode[data] | E0ESC);
80102db5:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102db8:	05 20 90 10 80       	add    $0x80109020,%eax
80102dbd:	0f b6 00             	movzbl (%eax),%eax
80102dc0:	83 c8 40             	or     $0x40,%eax
80102dc3:	0f b6 c0             	movzbl %al,%eax
80102dc6:	f7 d0                	not    %eax
80102dc8:	89 c2                	mov    %eax,%edx
80102dca:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102dcf:	21 d0                	and    %edx,%eax
80102dd1:	a3 dc 26 11 80       	mov    %eax,0x801126dc
    return 0;
80102dd6:	b8 00 00 00 00       	mov    $0x0,%eax
80102ddb:	e9 a2 00 00 00       	jmp    80102e82 <kbdgetc+0x14d>
  } else if(shift & E0ESC){
80102de0:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102de5:	83 e0 40             	and    $0x40,%eax
80102de8:	85 c0                	test   %eax,%eax
80102dea:	74 14                	je     80102e00 <kbdgetc+0xcb>
    // Last character was an E0 escape; or with 0x80
    data |= 0x80;
80102dec:	81 4d fc 80 00 00 00 	orl    $0x80,-0x4(%ebp)
    shift &= ~E0ESC;
80102df3:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102df8:	83 e0 bf             	and    $0xffffffbf,%eax
80102dfb:	a3 dc 26 11 80       	mov    %eax,0x801126dc
  }

  shift |= shiftcode[data];
80102e00:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102e03:	05 20 90 10 80       	add    $0x80109020,%eax
80102e08:	0f b6 00             	movzbl (%eax),%eax
80102e0b:	0f b6 d0             	movzbl %al,%edx
80102e0e:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102e13:	09 d0                	or     %edx,%eax
80102e15:	a3 dc 26 11 80       	mov    %eax,0x801126dc
  shift ^= togglecode[data];
80102e1a:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102e1d:	05 20 91 10 80       	add    $0x80109120,%eax
80102e22:	0f b6 00             	movzbl (%eax),%eax
80102e25:	0f b6 d0             	movzbl %al,%edx
80102e28:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102e2d:	31 d0                	xor    %edx,%eax
80102e2f:	a3 dc 26 11 80       	mov    %eax,0x801126dc
  c = charcode[shift & (CTL | SHIFT)][data];
80102e34:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102e39:	83 e0 03             	and    $0x3,%eax
80102e3c:	8b 14 85 20 95 10 80 	mov    -0x7fef6ae0(,%eax,4),%edx
80102e43:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102e46:	01 d0                	add    %edx,%eax
80102e48:	0f b6 00             	movzbl (%eax),%eax
80102e4b:	0f b6 c0             	movzbl %al,%eax
80102e4e:	89 45 f8             	mov    %eax,-0x8(%ebp)
  if(shift & CAPSLOCK){
80102e51:	a1 dc 26 11 80       	mov    0x801126dc,%eax
80102e56:	83 e0 08             	and    $0x8,%eax
80102e59:	85 c0                	test   %eax,%eax
80102e5b:	74 22                	je     80102e7f <kbdgetc+0x14a>
    if('a' <= c && c <= 'z')
80102e5d:	83 7d f8 60          	cmpl   $0x60,-0x8(%ebp)
80102e61:	76 0c                	jbe    80102e6f <kbdgetc+0x13a>
80102e63:	83 7d f8 7a          	cmpl   $0x7a,-0x8(%ebp)
80102e67:	77 06                	ja     80102e6f <kbdgetc+0x13a>
      c += 'A' - 'a';
80102e69:	83 6d f8 20          	subl   $0x20,-0x8(%ebp)
80102e6d:	eb 10                	jmp    80102e7f <kbdgetc+0x14a>
    else if('A' <= c && c <= 'Z')
80102e6f:	83 7d f8 40          	cmpl   $0x40,-0x8(%ebp)
80102e73:	76 0a                	jbe    80102e7f <kbdgetc+0x14a>
80102e75:	83 7d f8 5a          	cmpl   $0x5a,-0x8(%ebp)
80102e79:	77 04                	ja     80102e7f <kbdgetc+0x14a>
      c += 'a' - 'A';
80102e7b:	83 45 f8 20          	addl   $0x20,-0x8(%ebp)
  }
  return c;
80102e7f:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80102e82:	c9                   	leave  
80102e83:	c3                   	ret    

80102e84 <kbdintr>:

void
kbdintr(void)
{
80102e84:	55                   	push   %ebp
80102e85:	89 e5                	mov    %esp,%ebp
80102e87:	83 ec 08             	sub    $0x8,%esp
  consoleintr(kbdgetc);
80102e8a:	83 ec 0c             	sub    $0xc,%esp
80102e8d:	68 35 2d 10 80       	push   $0x80102d35
80102e92:	e8 b8 d9 ff ff       	call   8010084f <consoleintr>
80102e97:	83 c4 10             	add    $0x10,%esp
}
80102e9a:	90                   	nop
80102e9b:	c9                   	leave  
80102e9c:	c3                   	ret    

80102e9d <inb>:
{
80102e9d:	55                   	push   %ebp
80102e9e:	89 e5                	mov    %esp,%ebp
80102ea0:	83 ec 14             	sub    $0x14,%esp
80102ea3:	8b 45 08             	mov    0x8(%ebp),%eax
80102ea6:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102eaa:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
80102eae:	89 c2                	mov    %eax,%edx
80102eb0:	ec                   	in     (%dx),%al
80102eb1:	88 45 ff             	mov    %al,-0x1(%ebp)
  return data;
80102eb4:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
}
80102eb8:	c9                   	leave  
80102eb9:	c3                   	ret    

80102eba <outb>:
{
80102eba:	55                   	push   %ebp
80102ebb:	89 e5                	mov    %esp,%ebp
80102ebd:	83 ec 08             	sub    $0x8,%esp
80102ec0:	8b 45 08             	mov    0x8(%ebp),%eax
80102ec3:	8b 55 0c             	mov    0xc(%ebp),%edx
80102ec6:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
80102eca:	89 d0                	mov    %edx,%eax
80102ecc:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102ecf:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80102ed3:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80102ed7:	ee                   	out    %al,(%dx)
}
80102ed8:	90                   	nop
80102ed9:	c9                   	leave  
80102eda:	c3                   	ret    

80102edb <lapicw>:
volatile uint *lapic;  // Initialized in mp.c

//PAGEBREAK!
static void
lapicw(int index, int value)
{
80102edb:	55                   	push   %ebp
80102edc:	89 e5                	mov    %esp,%ebp
  lapic[index] = value;
80102ede:	8b 15 e0 26 11 80    	mov    0x801126e0,%edx
80102ee4:	8b 45 08             	mov    0x8(%ebp),%eax
80102ee7:	c1 e0 02             	shl    $0x2,%eax
80102eea:	01 c2                	add    %eax,%edx
80102eec:	8b 45 0c             	mov    0xc(%ebp),%eax
80102eef:	89 02                	mov    %eax,(%edx)
  lapic[ID];  // wait for write to finish, by reading
80102ef1:	a1 e0 26 11 80       	mov    0x801126e0,%eax
80102ef6:	83 c0 20             	add    $0x20,%eax
80102ef9:	8b 00                	mov    (%eax),%eax
}
80102efb:	90                   	nop
80102efc:	5d                   	pop    %ebp
80102efd:	c3                   	ret    

80102efe <lapicinit>:

void
lapicinit(void)
{
80102efe:	55                   	push   %ebp
80102eff:	89 e5                	mov    %esp,%ebp
  if(!lapic)
80102f01:	a1 e0 26 11 80       	mov    0x801126e0,%eax
80102f06:	85 c0                	test   %eax,%eax
80102f08:	0f 84 0c 01 00 00    	je     8010301a <lapicinit+0x11c>
    return;

  // Enable local APIC; set spurious interrupt vector.
  lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS));
80102f0e:	68 3f 01 00 00       	push   $0x13f
80102f13:	6a 3c                	push   $0x3c
80102f15:	e8 c1 ff ff ff       	call   80102edb <lapicw>
80102f1a:	83 c4 08             	add    $0x8,%esp

  // The timer repeatedly counts down at bus frequency
  // from lapic[TICR] and then issues an interrupt.
  // If xv6 cared more about precise timekeeping,
  // TICR would be calibrated using an external time source.
  lapicw(TDCR, X1);
80102f1d:	6a 0b                	push   $0xb
80102f1f:	68 f8 00 00 00       	push   $0xf8
80102f24:	e8 b2 ff ff ff       	call   80102edb <lapicw>
80102f29:	83 c4 08             	add    $0x8,%esp
  lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER));
80102f2c:	68 20 00 02 00       	push   $0x20020
80102f31:	68 c8 00 00 00       	push   $0xc8
80102f36:	e8 a0 ff ff ff       	call   80102edb <lapicw>
80102f3b:	83 c4 08             	add    $0x8,%esp
  lapicw(TICR, 10000000);
80102f3e:	68 80 96 98 00       	push   $0x989680
80102f43:	68 e0 00 00 00       	push   $0xe0
80102f48:	e8 8e ff ff ff       	call   80102edb <lapicw>
80102f4d:	83 c4 08             	add    $0x8,%esp

  // Disable logical interrupt lines.
  lapicw(LINT0, MASKED);
80102f50:	68 00 00 01 00       	push   $0x10000
80102f55:	68 d4 00 00 00       	push   $0xd4
80102f5a:	e8 7c ff ff ff       	call   80102edb <lapicw>
80102f5f:	83 c4 08             	add    $0x8,%esp
  lapicw(LINT1, MASKED);
80102f62:	68 00 00 01 00       	push   $0x10000
80102f67:	68 d8 00 00 00       	push   $0xd8
80102f6c:	e8 6a ff ff ff       	call   80102edb <lapicw>
80102f71:	83 c4 08             	add    $0x8,%esp

  // Disable performance counter overflow interrupts
  // on machines that provide that interrupt entry.
  if(((lapic[VER]>>16) & 0xFF) >= 4)
80102f74:	a1 e0 26 11 80       	mov    0x801126e0,%eax
80102f79:	83 c0 30             	add    $0x30,%eax
80102f7c:	8b 00                	mov    (%eax),%eax
80102f7e:	c1 e8 10             	shr    $0x10,%eax
80102f81:	25 fc 00 00 00       	and    $0xfc,%eax
80102f86:	85 c0                	test   %eax,%eax
80102f88:	74 12                	je     80102f9c <lapicinit+0x9e>
    lapicw(PCINT, MASKED);
80102f8a:	68 00 00 01 00       	push   $0x10000
80102f8f:	68 d0 00 00 00       	push   $0xd0
80102f94:	e8 42 ff ff ff       	call   80102edb <lapicw>
80102f99:	83 c4 08             	add    $0x8,%esp

  // Map error interrupt to IRQ_ERROR.
  lapicw(ERROR, T_IRQ0 + IRQ_ERROR);
80102f9c:	6a 33                	push   $0x33
80102f9e:	68 dc 00 00 00       	push   $0xdc
80102fa3:	e8 33 ff ff ff       	call   80102edb <lapicw>
80102fa8:	83 c4 08             	add    $0x8,%esp

  // Clear error status register (requires back-to-back writes).
  lapicw(ESR, 0);
80102fab:	6a 00                	push   $0x0
80102fad:	68 a0 00 00 00       	push   $0xa0
80102fb2:	e8 24 ff ff ff       	call   80102edb <lapicw>
80102fb7:	83 c4 08             	add    $0x8,%esp
  lapicw(ESR, 0);
80102fba:	6a 00                	push   $0x0
80102fbc:	68 a0 00 00 00       	push   $0xa0
80102fc1:	e8 15 ff ff ff       	call   80102edb <lapicw>
80102fc6:	83 c4 08             	add    $0x8,%esp

  // Ack any outstanding interrupts.
  lapicw(EOI, 0);
80102fc9:	6a 00                	push   $0x0
80102fcb:	6a 2c                	push   $0x2c
80102fcd:	e8 09 ff ff ff       	call   80102edb <lapicw>
80102fd2:	83 c4 08             	add    $0x8,%esp

  // Send an Init Level De-Assert to synchronise arbitration ID's.
  lapicw(ICRHI, 0);
80102fd5:	6a 00                	push   $0x0
80102fd7:	68 c4 00 00 00       	push   $0xc4
80102fdc:	e8 fa fe ff ff       	call   80102edb <lapicw>
80102fe1:	83 c4 08             	add    $0x8,%esp
  lapicw(ICRLO, BCAST | INIT | LEVEL);
80102fe4:	68 00 85 08 00       	push   $0x88500
80102fe9:	68 c0 00 00 00       	push   $0xc0
80102fee:	e8 e8 fe ff ff       	call   80102edb <lapicw>
80102ff3:	83 c4 08             	add    $0x8,%esp
  while(lapic[ICRLO] & DELIVS)
80102ff6:	90                   	nop
80102ff7:	a1 e0 26 11 80       	mov    0x801126e0,%eax
80102ffc:	05 00 03 00 00       	add    $0x300,%eax
80103001:	8b 00                	mov    (%eax),%eax
80103003:	25 00 10 00 00       	and    $0x1000,%eax
80103008:	85 c0                	test   %eax,%eax
8010300a:	75 eb                	jne    80102ff7 <lapicinit+0xf9>
    ;

  // Enable interrupts on the APIC (but not on the processor).
  lapicw(TPR, 0);
8010300c:	6a 00                	push   $0x0
8010300e:	6a 20                	push   $0x20
80103010:	e8 c6 fe ff ff       	call   80102edb <lapicw>
80103015:	83 c4 08             	add    $0x8,%esp
80103018:	eb 01                	jmp    8010301b <lapicinit+0x11d>
    return;
8010301a:	90                   	nop
}
8010301b:	c9                   	leave  
8010301c:	c3                   	ret    

8010301d <lapicid>:

int
lapicid(void)
{
8010301d:	55                   	push   %ebp
8010301e:	89 e5                	mov    %esp,%ebp
  if (!lapic)
80103020:	a1 e0 26 11 80       	mov    0x801126e0,%eax
80103025:	85 c0                	test   %eax,%eax
80103027:	75 07                	jne    80103030 <lapicid+0x13>
    return 0;
80103029:	b8 00 00 00 00       	mov    $0x0,%eax
8010302e:	eb 0d                	jmp    8010303d <lapicid+0x20>
  return lapic[ID] >> 24;
80103030:	a1 e0 26 11 80       	mov    0x801126e0,%eax
80103035:	83 c0 20             	add    $0x20,%eax
80103038:	8b 00                	mov    (%eax),%eax
8010303a:	c1 e8 18             	shr    $0x18,%eax
}
8010303d:	5d                   	pop    %ebp
8010303e:	c3                   	ret    

8010303f <lapiceoi>:

// Acknowledge interrupt.
void
lapiceoi(void)
{
8010303f:	55                   	push   %ebp
80103040:	89 e5                	mov    %esp,%ebp
  if(lapic)
80103042:	a1 e0 26 11 80       	mov    0x801126e0,%eax
80103047:	85 c0                	test   %eax,%eax
80103049:	74 0c                	je     80103057 <lapiceoi+0x18>
    lapicw(EOI, 0);
8010304b:	6a 00                	push   $0x0
8010304d:	6a 2c                	push   $0x2c
8010304f:	e8 87 fe ff ff       	call   80102edb <lapicw>
80103054:	83 c4 08             	add    $0x8,%esp
}
80103057:	90                   	nop
80103058:	c9                   	leave  
80103059:	c3                   	ret    

8010305a <microdelay>:

// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
8010305a:	55                   	push   %ebp
8010305b:	89 e5                	mov    %esp,%ebp
}
8010305d:	90                   	nop
8010305e:	5d                   	pop    %ebp
8010305f:	c3                   	ret    

80103060 <lapicstartap>:

// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80103060:	55                   	push   %ebp
80103061:	89 e5                	mov    %esp,%ebp
80103063:	83 ec 14             	sub    $0x14,%esp
80103066:	8b 45 08             	mov    0x8(%ebp),%eax
80103069:	88 45 ec             	mov    %al,-0x14(%ebp)
  ushort *wrv;

  // "The BSP must initialize CMOS shutdown code to 0AH
  // and the warm reset vector (DWORD based at 40:67) to point at
  // the AP startup code prior to the [universal startup algorithm]."
  outb(CMOS_PORT, 0xF);  // offset 0xF is shutdown code
8010306c:	6a 0f                	push   $0xf
8010306e:	6a 70                	push   $0x70
80103070:	e8 45 fe ff ff       	call   80102eba <outb>
80103075:	83 c4 08             	add    $0x8,%esp
  outb(CMOS_PORT+1, 0x0A);
80103078:	6a 0a                	push   $0xa
8010307a:	6a 71                	push   $0x71
8010307c:	e8 39 fe ff ff       	call   80102eba <outb>
80103081:	83 c4 08             	add    $0x8,%esp
  wrv = (ushort*)P2V((0x40<<4 | 0x67));  // Warm reset vector
80103084:	c7 45 f8 67 04 00 80 	movl   $0x80000467,-0x8(%ebp)
  wrv[0] = 0;
8010308b:	8b 45 f8             	mov    -0x8(%ebp),%eax
8010308e:	66 c7 00 00 00       	movw   $0x0,(%eax)
  wrv[1] = addr >> 4;
80103093:	8b 45 0c             	mov    0xc(%ebp),%eax
80103096:	c1 e8 04             	shr    $0x4,%eax
80103099:	89 c2                	mov    %eax,%edx
8010309b:	8b 45 f8             	mov    -0x8(%ebp),%eax
8010309e:	83 c0 02             	add    $0x2,%eax
801030a1:	66 89 10             	mov    %dx,(%eax)

  // "Universal startup algorithm."
  // Send INIT (level-triggered) interrupt to reset other CPU.
  lapicw(ICRHI, apicid<<24);
801030a4:	0f b6 45 ec          	movzbl -0x14(%ebp),%eax
801030a8:	c1 e0 18             	shl    $0x18,%eax
801030ab:	50                   	push   %eax
801030ac:	68 c4 00 00 00       	push   $0xc4
801030b1:	e8 25 fe ff ff       	call   80102edb <lapicw>
801030b6:	83 c4 08             	add    $0x8,%esp
  lapicw(ICRLO, INIT | LEVEL | ASSERT);
801030b9:	68 00 c5 00 00       	push   $0xc500
801030be:	68 c0 00 00 00       	push   $0xc0
801030c3:	e8 13 fe ff ff       	call   80102edb <lapicw>
801030c8:	83 c4 08             	add    $0x8,%esp
  microdelay(200);
801030cb:	68 c8 00 00 00       	push   $0xc8
801030d0:	e8 85 ff ff ff       	call   8010305a <microdelay>
801030d5:	83 c4 04             	add    $0x4,%esp
  lapicw(ICRLO, INIT | LEVEL);
801030d8:	68 00 85 00 00       	push   $0x8500
801030dd:	68 c0 00 00 00       	push   $0xc0
801030e2:	e8 f4 fd ff ff       	call   80102edb <lapicw>
801030e7:	83 c4 08             	add    $0x8,%esp
  microdelay(100);    // should be 10ms, but too slow in Bochs!
801030ea:	6a 64                	push   $0x64
801030ec:	e8 69 ff ff ff       	call   8010305a <microdelay>
801030f1:	83 c4 04             	add    $0x4,%esp
  // Send startup IPI (twice!) to enter code.
  // Regular hardware is supposed to only accept a STARTUP
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
801030f4:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801030fb:	eb 3d                	jmp    8010313a <lapicstartap+0xda>
    lapicw(ICRHI, apicid<<24);
801030fd:	0f b6 45 ec          	movzbl -0x14(%ebp),%eax
80103101:	c1 e0 18             	shl    $0x18,%eax
80103104:	50                   	push   %eax
80103105:	68 c4 00 00 00       	push   $0xc4
8010310a:	e8 cc fd ff ff       	call   80102edb <lapicw>
8010310f:	83 c4 08             	add    $0x8,%esp
    lapicw(ICRLO, STARTUP | (addr>>12));
80103112:	8b 45 0c             	mov    0xc(%ebp),%eax
80103115:	c1 e8 0c             	shr    $0xc,%eax
80103118:	80 cc 06             	or     $0x6,%ah
8010311b:	50                   	push   %eax
8010311c:	68 c0 00 00 00       	push   $0xc0
80103121:	e8 b5 fd ff ff       	call   80102edb <lapicw>
80103126:	83 c4 08             	add    $0x8,%esp
    microdelay(200);
80103129:	68 c8 00 00 00       	push   $0xc8
8010312e:	e8 27 ff ff ff       	call   8010305a <microdelay>
80103133:	83 c4 04             	add    $0x4,%esp
  for(i = 0; i < 2; i++){
80103136:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
8010313a:	83 7d fc 01          	cmpl   $0x1,-0x4(%ebp)
8010313e:	7e bd                	jle    801030fd <lapicstartap+0x9d>
  }
}
80103140:	90                   	nop
80103141:	90                   	nop
80103142:	c9                   	leave  
80103143:	c3                   	ret    

80103144 <cmos_read>:
#define DAY     0x07
#define MONTH   0x08
#define YEAR    0x09

static uint cmos_read(uint reg)
{
80103144:	55                   	push   %ebp
80103145:	89 e5                	mov    %esp,%ebp
  outb(CMOS_PORT,  reg);
80103147:	8b 45 08             	mov    0x8(%ebp),%eax
8010314a:	0f b6 c0             	movzbl %al,%eax
8010314d:	50                   	push   %eax
8010314e:	6a 70                	push   $0x70
80103150:	e8 65 fd ff ff       	call   80102eba <outb>
80103155:	83 c4 08             	add    $0x8,%esp
  microdelay(200);
80103158:	68 c8 00 00 00       	push   $0xc8
8010315d:	e8 f8 fe ff ff       	call   8010305a <microdelay>
80103162:	83 c4 04             	add    $0x4,%esp

  return inb(CMOS_RETURN);
80103165:	6a 71                	push   $0x71
80103167:	e8 31 fd ff ff       	call   80102e9d <inb>
8010316c:	83 c4 04             	add    $0x4,%esp
8010316f:	0f b6 c0             	movzbl %al,%eax
}
80103172:	c9                   	leave  
80103173:	c3                   	ret    

80103174 <fill_rtcdate>:

static void fill_rtcdate(struct rtcdate *r)
{
80103174:	55                   	push   %ebp
80103175:	89 e5                	mov    %esp,%ebp
  r->second = cmos_read(SECS);
80103177:	6a 00                	push   $0x0
80103179:	e8 c6 ff ff ff       	call   80103144 <cmos_read>
8010317e:	83 c4 04             	add    $0x4,%esp
80103181:	8b 55 08             	mov    0x8(%ebp),%edx
80103184:	89 02                	mov    %eax,(%edx)
  r->minute = cmos_read(MINS);
80103186:	6a 02                	push   $0x2
80103188:	e8 b7 ff ff ff       	call   80103144 <cmos_read>
8010318d:	83 c4 04             	add    $0x4,%esp
80103190:	8b 55 08             	mov    0x8(%ebp),%edx
80103193:	89 42 04             	mov    %eax,0x4(%edx)
  r->hour   = cmos_read(HOURS);
80103196:	6a 04                	push   $0x4
80103198:	e8 a7 ff ff ff       	call   80103144 <cmos_read>
8010319d:	83 c4 04             	add    $0x4,%esp
801031a0:	8b 55 08             	mov    0x8(%ebp),%edx
801031a3:	89 42 08             	mov    %eax,0x8(%edx)
  r->day    = cmos_read(DAY);
801031a6:	6a 07                	push   $0x7
801031a8:	e8 97 ff ff ff       	call   80103144 <cmos_read>
801031ad:	83 c4 04             	add    $0x4,%esp
801031b0:	8b 55 08             	mov    0x8(%ebp),%edx
801031b3:	89 42 0c             	mov    %eax,0xc(%edx)
  r->month  = cmos_read(MONTH);
801031b6:	6a 08                	push   $0x8
801031b8:	e8 87 ff ff ff       	call   80103144 <cmos_read>
801031bd:	83 c4 04             	add    $0x4,%esp
801031c0:	8b 55 08             	mov    0x8(%ebp),%edx
801031c3:	89 42 10             	mov    %eax,0x10(%edx)
  r->year   = cmos_read(YEAR);
801031c6:	6a 09                	push   $0x9
801031c8:	e8 77 ff ff ff       	call   80103144 <cmos_read>
801031cd:	83 c4 04             	add    $0x4,%esp
801031d0:	8b 55 08             	mov    0x8(%ebp),%edx
801031d3:	89 42 14             	mov    %eax,0x14(%edx)
}
801031d6:	90                   	nop
801031d7:	c9                   	leave  
801031d8:	c3                   	ret    

801031d9 <cmostime>:

// qemu seems to use 24-hour GWT and the values are BCD encoded
void cmostime(struct rtcdate *r)
{
801031d9:	55                   	push   %ebp
801031da:	89 e5                	mov    %esp,%ebp
801031dc:	83 ec 48             	sub    $0x48,%esp
  struct rtcdate t1, t2;
  int sb, bcd;

  sb = cmos_read(CMOS_STATB);
801031df:	6a 0b                	push   $0xb
801031e1:	e8 5e ff ff ff       	call   80103144 <cmos_read>
801031e6:	83 c4 04             	add    $0x4,%esp
801031e9:	89 45 f4             	mov    %eax,-0xc(%ebp)

  bcd = (sb & (1 << 2)) == 0;
801031ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801031ef:	83 e0 04             	and    $0x4,%eax
801031f2:	85 c0                	test   %eax,%eax
801031f4:	0f 94 c0             	sete   %al
801031f7:	0f b6 c0             	movzbl %al,%eax
801031fa:	89 45 f0             	mov    %eax,-0x10(%ebp)

  // make sure CMOS doesn't modify time while we read it
  for(;;) {
    fill_rtcdate(&t1);
801031fd:	8d 45 d8             	lea    -0x28(%ebp),%eax
80103200:	50                   	push   %eax
80103201:	e8 6e ff ff ff       	call   80103174 <fill_rtcdate>
80103206:	83 c4 04             	add    $0x4,%esp
    if(cmos_read(CMOS_STATA) & CMOS_UIP)
80103209:	6a 0a                	push   $0xa
8010320b:	e8 34 ff ff ff       	call   80103144 <cmos_read>
80103210:	83 c4 04             	add    $0x4,%esp
80103213:	25 80 00 00 00       	and    $0x80,%eax
80103218:	85 c0                	test   %eax,%eax
8010321a:	75 27                	jne    80103243 <cmostime+0x6a>
        continue;
    fill_rtcdate(&t2);
8010321c:	8d 45 c0             	lea    -0x40(%ebp),%eax
8010321f:	50                   	push   %eax
80103220:	e8 4f ff ff ff       	call   80103174 <fill_rtcdate>
80103225:	83 c4 04             	add    $0x4,%esp
    if(memcmp(&t1, &t2, sizeof(t1)) == 0)
80103228:	83 ec 04             	sub    $0x4,%esp
8010322b:	6a 18                	push   $0x18
8010322d:	8d 45 c0             	lea    -0x40(%ebp),%eax
80103230:	50                   	push   %eax
80103231:	8d 45 d8             	lea    -0x28(%ebp),%eax
80103234:	50                   	push   %eax
80103235:	e8 5d 20 00 00       	call   80105297 <memcmp>
8010323a:	83 c4 10             	add    $0x10,%esp
8010323d:	85 c0                	test   %eax,%eax
8010323f:	74 05                	je     80103246 <cmostime+0x6d>
80103241:	eb ba                	jmp    801031fd <cmostime+0x24>
        continue;
80103243:	90                   	nop
    fill_rtcdate(&t1);
80103244:	eb b7                	jmp    801031fd <cmostime+0x24>
      break;
80103246:	90                   	nop
  }

  // convert
  if(bcd) {
80103247:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010324b:	0f 84 b4 00 00 00    	je     80103305 <cmostime+0x12c>
#define    CONV(x)     (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
    CONV(second);
80103251:	8b 45 d8             	mov    -0x28(%ebp),%eax
80103254:	c1 e8 04             	shr    $0x4,%eax
80103257:	89 c2                	mov    %eax,%edx
80103259:	89 d0                	mov    %edx,%eax
8010325b:	c1 e0 02             	shl    $0x2,%eax
8010325e:	01 d0                	add    %edx,%eax
80103260:	01 c0                	add    %eax,%eax
80103262:	89 c2                	mov    %eax,%edx
80103264:	8b 45 d8             	mov    -0x28(%ebp),%eax
80103267:	83 e0 0f             	and    $0xf,%eax
8010326a:	01 d0                	add    %edx,%eax
8010326c:	89 45 d8             	mov    %eax,-0x28(%ebp)
    CONV(minute);
8010326f:	8b 45 dc             	mov    -0x24(%ebp),%eax
80103272:	c1 e8 04             	shr    $0x4,%eax
80103275:	89 c2                	mov    %eax,%edx
80103277:	89 d0                	mov    %edx,%eax
80103279:	c1 e0 02             	shl    $0x2,%eax
8010327c:	01 d0                	add    %edx,%eax
8010327e:	01 c0                	add    %eax,%eax
80103280:	89 c2                	mov    %eax,%edx
80103282:	8b 45 dc             	mov    -0x24(%ebp),%eax
80103285:	83 e0 0f             	and    $0xf,%eax
80103288:	01 d0                	add    %edx,%eax
8010328a:	89 45 dc             	mov    %eax,-0x24(%ebp)
    CONV(hour  );
8010328d:	8b 45 e0             	mov    -0x20(%ebp),%eax
80103290:	c1 e8 04             	shr    $0x4,%eax
80103293:	89 c2                	mov    %eax,%edx
80103295:	89 d0                	mov    %edx,%eax
80103297:	c1 e0 02             	shl    $0x2,%eax
8010329a:	01 d0                	add    %edx,%eax
8010329c:	01 c0                	add    %eax,%eax
8010329e:	89 c2                	mov    %eax,%edx
801032a0:	8b 45 e0             	mov    -0x20(%ebp),%eax
801032a3:	83 e0 0f             	and    $0xf,%eax
801032a6:	01 d0                	add    %edx,%eax
801032a8:	89 45 e0             	mov    %eax,-0x20(%ebp)
    CONV(day   );
801032ab:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801032ae:	c1 e8 04             	shr    $0x4,%eax
801032b1:	89 c2                	mov    %eax,%edx
801032b3:	89 d0                	mov    %edx,%eax
801032b5:	c1 e0 02             	shl    $0x2,%eax
801032b8:	01 d0                	add    %edx,%eax
801032ba:	01 c0                	add    %eax,%eax
801032bc:	89 c2                	mov    %eax,%edx
801032be:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801032c1:	83 e0 0f             	and    $0xf,%eax
801032c4:	01 d0                	add    %edx,%eax
801032c6:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    CONV(month );
801032c9:	8b 45 e8             	mov    -0x18(%ebp),%eax
801032cc:	c1 e8 04             	shr    $0x4,%eax
801032cf:	89 c2                	mov    %eax,%edx
801032d1:	89 d0                	mov    %edx,%eax
801032d3:	c1 e0 02             	shl    $0x2,%eax
801032d6:	01 d0                	add    %edx,%eax
801032d8:	01 c0                	add    %eax,%eax
801032da:	89 c2                	mov    %eax,%edx
801032dc:	8b 45 e8             	mov    -0x18(%ebp),%eax
801032df:	83 e0 0f             	and    $0xf,%eax
801032e2:	01 d0                	add    %edx,%eax
801032e4:	89 45 e8             	mov    %eax,-0x18(%ebp)
    CONV(year  );
801032e7:	8b 45 ec             	mov    -0x14(%ebp),%eax
801032ea:	c1 e8 04             	shr    $0x4,%eax
801032ed:	89 c2                	mov    %eax,%edx
801032ef:	89 d0                	mov    %edx,%eax
801032f1:	c1 e0 02             	shl    $0x2,%eax
801032f4:	01 d0                	add    %edx,%eax
801032f6:	01 c0                	add    %eax,%eax
801032f8:	89 c2                	mov    %eax,%edx
801032fa:	8b 45 ec             	mov    -0x14(%ebp),%eax
801032fd:	83 e0 0f             	and    $0xf,%eax
80103300:	01 d0                	add    %edx,%eax
80103302:	89 45 ec             	mov    %eax,-0x14(%ebp)
#undef     CONV
  }

  *r = t1;
80103305:	8b 45 08             	mov    0x8(%ebp),%eax
80103308:	8b 55 d8             	mov    -0x28(%ebp),%edx
8010330b:	89 10                	mov    %edx,(%eax)
8010330d:	8b 55 dc             	mov    -0x24(%ebp),%edx
80103310:	89 50 04             	mov    %edx,0x4(%eax)
80103313:	8b 55 e0             	mov    -0x20(%ebp),%edx
80103316:	89 50 08             	mov    %edx,0x8(%eax)
80103319:	8b 55 e4             	mov    -0x1c(%ebp),%edx
8010331c:	89 50 0c             	mov    %edx,0xc(%eax)
8010331f:	8b 55 e8             	mov    -0x18(%ebp),%edx
80103322:	89 50 10             	mov    %edx,0x10(%eax)
80103325:	8b 55 ec             	mov    -0x14(%ebp),%edx
80103328:	89 50 14             	mov    %edx,0x14(%eax)
  r->year += 2000;
8010332b:	8b 45 08             	mov    0x8(%ebp),%eax
8010332e:	8b 40 14             	mov    0x14(%eax),%eax
80103331:	8d 90 d0 07 00 00    	lea    0x7d0(%eax),%edx
80103337:	8b 45 08             	mov    0x8(%ebp),%eax
8010333a:	89 50 14             	mov    %edx,0x14(%eax)
}
8010333d:	90                   	nop
8010333e:	c9                   	leave  
8010333f:	c3                   	ret    

80103340 <initlog>:
static void recover_from_log(void);
static void commit();

void
initlog(int dev)
{
80103340:	55                   	push   %ebp
80103341:	89 e5                	mov    %esp,%ebp
80103343:	83 ec 28             	sub    $0x28,%esp
  if (sizeof(struct logheader) >= BSIZE)
    panic("initlog: too big logheader");

  struct superblock sb;
  initlock(&log.lock, "log");
80103346:	83 ec 08             	sub    $0x8,%esp
80103349:	68 fd 86 10 80       	push   $0x801086fd
8010334e:	68 00 27 11 80       	push   $0x80112700
80103353:	e8 40 1c 00 00       	call   80104f98 <initlock>
80103358:	83 c4 10             	add    $0x10,%esp
  readsb(dev, &sb);
8010335b:	83 ec 08             	sub    $0x8,%esp
8010335e:	8d 45 dc             	lea    -0x24(%ebp),%eax
80103361:	50                   	push   %eax
80103362:	ff 75 08             	push   0x8(%ebp)
80103365:	e8 a7 e0 ff ff       	call   80101411 <readsb>
8010336a:	83 c4 10             	add    $0x10,%esp
  log.start = sb.logstart;
8010336d:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103370:	a3 34 27 11 80       	mov    %eax,0x80112734
  log.size = sb.nlog;
80103375:	8b 45 e8             	mov    -0x18(%ebp),%eax
80103378:	a3 38 27 11 80       	mov    %eax,0x80112738
  log.dev = dev;
8010337d:	8b 45 08             	mov    0x8(%ebp),%eax
80103380:	a3 44 27 11 80       	mov    %eax,0x80112744
  recover_from_log();
80103385:	e8 b3 01 00 00       	call   8010353d <recover_from_log>
}
8010338a:	90                   	nop
8010338b:	c9                   	leave  
8010338c:	c3                   	ret    

8010338d <install_trans>:

// Copy committed blocks from log to their home location
static void
install_trans(void)
{
8010338d:	55                   	push   %ebp
8010338e:	89 e5                	mov    %esp,%ebp
80103390:	83 ec 18             	sub    $0x18,%esp
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
80103393:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010339a:	e9 95 00 00 00       	jmp    80103434 <install_trans+0xa7>
    struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
8010339f:	8b 15 34 27 11 80    	mov    0x80112734,%edx
801033a5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801033a8:	01 d0                	add    %edx,%eax
801033aa:	83 c0 01             	add    $0x1,%eax
801033ad:	89 c2                	mov    %eax,%edx
801033af:	a1 44 27 11 80       	mov    0x80112744,%eax
801033b4:	83 ec 08             	sub    $0x8,%esp
801033b7:	52                   	push   %edx
801033b8:	50                   	push   %eax
801033b9:	e8 11 ce ff ff       	call   801001cf <bread>
801033be:	83 c4 10             	add    $0x10,%esp
801033c1:	89 45 f0             	mov    %eax,-0x10(%ebp)
    struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
801033c4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801033c7:	83 c0 10             	add    $0x10,%eax
801033ca:	8b 04 85 0c 27 11 80 	mov    -0x7feed8f4(,%eax,4),%eax
801033d1:	89 c2                	mov    %eax,%edx
801033d3:	a1 44 27 11 80       	mov    0x80112744,%eax
801033d8:	83 ec 08             	sub    $0x8,%esp
801033db:	52                   	push   %edx
801033dc:	50                   	push   %eax
801033dd:	e8 ed cd ff ff       	call   801001cf <bread>
801033e2:	83 c4 10             	add    $0x10,%esp
801033e5:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(dbuf->data, lbuf->data, BSIZE);  // copy block to dst
801033e8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801033eb:	8d 50 5c             	lea    0x5c(%eax),%edx
801033ee:	8b 45 ec             	mov    -0x14(%ebp),%eax
801033f1:	83 c0 5c             	add    $0x5c,%eax
801033f4:	83 ec 04             	sub    $0x4,%esp
801033f7:	68 00 02 00 00       	push   $0x200
801033fc:	52                   	push   %edx
801033fd:	50                   	push   %eax
801033fe:	e8 ec 1e 00 00       	call   801052ef <memmove>
80103403:	83 c4 10             	add    $0x10,%esp
    bwrite(dbuf);  // write dst to disk
80103406:	83 ec 0c             	sub    $0xc,%esp
80103409:	ff 75 ec             	push   -0x14(%ebp)
8010340c:	e8 f7 cd ff ff       	call   80100208 <bwrite>
80103411:	83 c4 10             	add    $0x10,%esp
    brelse(lbuf);
80103414:	83 ec 0c             	sub    $0xc,%esp
80103417:	ff 75 f0             	push   -0x10(%ebp)
8010341a:	e8 32 ce ff ff       	call   80100251 <brelse>
8010341f:	83 c4 10             	add    $0x10,%esp
    brelse(dbuf);
80103422:	83 ec 0c             	sub    $0xc,%esp
80103425:	ff 75 ec             	push   -0x14(%ebp)
80103428:	e8 24 ce ff ff       	call   80100251 <brelse>
8010342d:	83 c4 10             	add    $0x10,%esp
  for (tail = 0; tail < log.lh.n; tail++) {
80103430:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103434:	a1 48 27 11 80       	mov    0x80112748,%eax
80103439:	39 45 f4             	cmp    %eax,-0xc(%ebp)
8010343c:	0f 8c 5d ff ff ff    	jl     8010339f <install_trans+0x12>
  }
}
80103442:	90                   	nop
80103443:	90                   	nop
80103444:	c9                   	leave  
80103445:	c3                   	ret    

80103446 <read_head>:

// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
80103446:	55                   	push   %ebp
80103447:	89 e5                	mov    %esp,%ebp
80103449:	83 ec 18             	sub    $0x18,%esp
  struct buf *buf = bread(log.dev, log.start);
8010344c:	a1 34 27 11 80       	mov    0x80112734,%eax
80103451:	89 c2                	mov    %eax,%edx
80103453:	a1 44 27 11 80       	mov    0x80112744,%eax
80103458:	83 ec 08             	sub    $0x8,%esp
8010345b:	52                   	push   %edx
8010345c:	50                   	push   %eax
8010345d:	e8 6d cd ff ff       	call   801001cf <bread>
80103462:	83 c4 10             	add    $0x10,%esp
80103465:	89 45 f0             	mov    %eax,-0x10(%ebp)
  struct logheader *lh = (struct logheader *) (buf->data);
80103468:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010346b:	83 c0 5c             	add    $0x5c,%eax
8010346e:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int i;
  log.lh.n = lh->n;
80103471:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103474:	8b 00                	mov    (%eax),%eax
80103476:	a3 48 27 11 80       	mov    %eax,0x80112748
  for (i = 0; i < log.lh.n; i++) {
8010347b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103482:	eb 1b                	jmp    8010349f <read_head+0x59>
    log.lh.block[i] = lh->block[i];
80103484:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103487:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010348a:	8b 44 90 04          	mov    0x4(%eax,%edx,4),%eax
8010348e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103491:	83 c2 10             	add    $0x10,%edx
80103494:	89 04 95 0c 27 11 80 	mov    %eax,-0x7feed8f4(,%edx,4)
  for (i = 0; i < log.lh.n; i++) {
8010349b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010349f:	a1 48 27 11 80       	mov    0x80112748,%eax
801034a4:	39 45 f4             	cmp    %eax,-0xc(%ebp)
801034a7:	7c db                	jl     80103484 <read_head+0x3e>
  }
  brelse(buf);
801034a9:	83 ec 0c             	sub    $0xc,%esp
801034ac:	ff 75 f0             	push   -0x10(%ebp)
801034af:	e8 9d cd ff ff       	call   80100251 <brelse>
801034b4:	83 c4 10             	add    $0x10,%esp
}
801034b7:	90                   	nop
801034b8:	c9                   	leave  
801034b9:	c3                   	ret    

801034ba <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
801034ba:	55                   	push   %ebp
801034bb:	89 e5                	mov    %esp,%ebp
801034bd:	83 ec 18             	sub    $0x18,%esp
  struct buf *buf = bread(log.dev, log.start);
801034c0:	a1 34 27 11 80       	mov    0x80112734,%eax
801034c5:	89 c2                	mov    %eax,%edx
801034c7:	a1 44 27 11 80       	mov    0x80112744,%eax
801034cc:	83 ec 08             	sub    $0x8,%esp
801034cf:	52                   	push   %edx
801034d0:	50                   	push   %eax
801034d1:	e8 f9 cc ff ff       	call   801001cf <bread>
801034d6:	83 c4 10             	add    $0x10,%esp
801034d9:	89 45 f0             	mov    %eax,-0x10(%ebp)
  struct logheader *hb = (struct logheader *) (buf->data);
801034dc:	8b 45 f0             	mov    -0x10(%ebp),%eax
801034df:	83 c0 5c             	add    $0x5c,%eax
801034e2:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int i;
  hb->n = log.lh.n;
801034e5:	8b 15 48 27 11 80    	mov    0x80112748,%edx
801034eb:	8b 45 ec             	mov    -0x14(%ebp),%eax
801034ee:	89 10                	mov    %edx,(%eax)
  for (i = 0; i < log.lh.n; i++) {
801034f0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801034f7:	eb 1b                	jmp    80103514 <write_head+0x5a>
    hb->block[i] = log.lh.block[i];
801034f9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801034fc:	83 c0 10             	add    $0x10,%eax
801034ff:	8b 0c 85 0c 27 11 80 	mov    -0x7feed8f4(,%eax,4),%ecx
80103506:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103509:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010350c:	89 4c 90 04          	mov    %ecx,0x4(%eax,%edx,4)
  for (i = 0; i < log.lh.n; i++) {
80103510:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103514:	a1 48 27 11 80       	mov    0x80112748,%eax
80103519:	39 45 f4             	cmp    %eax,-0xc(%ebp)
8010351c:	7c db                	jl     801034f9 <write_head+0x3f>
  }
  bwrite(buf);
8010351e:	83 ec 0c             	sub    $0xc,%esp
80103521:	ff 75 f0             	push   -0x10(%ebp)
80103524:	e8 df cc ff ff       	call   80100208 <bwrite>
80103529:	83 c4 10             	add    $0x10,%esp
  brelse(buf);
8010352c:	83 ec 0c             	sub    $0xc,%esp
8010352f:	ff 75 f0             	push   -0x10(%ebp)
80103532:	e8 1a cd ff ff       	call   80100251 <brelse>
80103537:	83 c4 10             	add    $0x10,%esp
}
8010353a:	90                   	nop
8010353b:	c9                   	leave  
8010353c:	c3                   	ret    

8010353d <recover_from_log>:

static void
recover_from_log(void)
{
8010353d:	55                   	push   %ebp
8010353e:	89 e5                	mov    %esp,%ebp
80103540:	83 ec 08             	sub    $0x8,%esp
  read_head();
80103543:	e8 fe fe ff ff       	call   80103446 <read_head>
  install_trans(); // if committed, copy from log to disk
80103548:	e8 40 fe ff ff       	call   8010338d <install_trans>
  log.lh.n = 0;
8010354d:	c7 05 48 27 11 80 00 	movl   $0x0,0x80112748
80103554:	00 00 00 
  write_head(); // clear the log
80103557:	e8 5e ff ff ff       	call   801034ba <write_head>
}
8010355c:	90                   	nop
8010355d:	c9                   	leave  
8010355e:	c3                   	ret    

8010355f <begin_op>:

// called at the start of each FS system call.
void
begin_op(void)
{
8010355f:	55                   	push   %ebp
80103560:	89 e5                	mov    %esp,%ebp
80103562:	83 ec 08             	sub    $0x8,%esp
  acquire(&log.lock);
80103565:	83 ec 0c             	sub    $0xc,%esp
80103568:	68 00 27 11 80       	push   $0x80112700
8010356d:	e8 48 1a 00 00       	call   80104fba <acquire>
80103572:	83 c4 10             	add    $0x10,%esp
  while(1){
    if(log.committing){
80103575:	a1 40 27 11 80       	mov    0x80112740,%eax
8010357a:	85 c0                	test   %eax,%eax
8010357c:	74 17                	je     80103595 <begin_op+0x36>
      sleep(&log, &log.lock);
8010357e:	83 ec 08             	sub    $0x8,%esp
80103581:	68 00 27 11 80       	push   $0x80112700
80103586:	68 00 27 11 80       	push   $0x80112700
8010358b:	e8 0f 16 00 00       	call   80104b9f <sleep>
80103590:	83 c4 10             	add    $0x10,%esp
80103593:	eb e0                	jmp    80103575 <begin_op+0x16>
    } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
80103595:	8b 0d 48 27 11 80    	mov    0x80112748,%ecx
8010359b:	a1 3c 27 11 80       	mov    0x8011273c,%eax
801035a0:	8d 50 01             	lea    0x1(%eax),%edx
801035a3:	89 d0                	mov    %edx,%eax
801035a5:	c1 e0 02             	shl    $0x2,%eax
801035a8:	01 d0                	add    %edx,%eax
801035aa:	01 c0                	add    %eax,%eax
801035ac:	01 c8                	add    %ecx,%eax
801035ae:	83 f8 1e             	cmp    $0x1e,%eax
801035b1:	7e 17                	jle    801035ca <begin_op+0x6b>
      // this op might exhaust log space; wait for commit.
      sleep(&log, &log.lock);
801035b3:	83 ec 08             	sub    $0x8,%esp
801035b6:	68 00 27 11 80       	push   $0x80112700
801035bb:	68 00 27 11 80       	push   $0x80112700
801035c0:	e8 da 15 00 00       	call   80104b9f <sleep>
801035c5:	83 c4 10             	add    $0x10,%esp
801035c8:	eb ab                	jmp    80103575 <begin_op+0x16>
    } else {
      log.outstanding += 1;
801035ca:	a1 3c 27 11 80       	mov    0x8011273c,%eax
801035cf:	83 c0 01             	add    $0x1,%eax
801035d2:	a3 3c 27 11 80       	mov    %eax,0x8011273c
      release(&log.lock);
801035d7:	83 ec 0c             	sub    $0xc,%esp
801035da:	68 00 27 11 80       	push   $0x80112700
801035df:	e8 44 1a 00 00       	call   80105028 <release>
801035e4:	83 c4 10             	add    $0x10,%esp
      break;
801035e7:	90                   	nop
    }
  }
}
801035e8:	90                   	nop
801035e9:	c9                   	leave  
801035ea:	c3                   	ret    

801035eb <end_op>:

// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
801035eb:	55                   	push   %ebp
801035ec:	89 e5                	mov    %esp,%ebp
801035ee:	83 ec 18             	sub    $0x18,%esp
  int do_commit = 0;
801035f1:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

  acquire(&log.lock);
801035f8:	83 ec 0c             	sub    $0xc,%esp
801035fb:	68 00 27 11 80       	push   $0x80112700
80103600:	e8 b5 19 00 00       	call   80104fba <acquire>
80103605:	83 c4 10             	add    $0x10,%esp
  log.outstanding -= 1;
80103608:	a1 3c 27 11 80       	mov    0x8011273c,%eax
8010360d:	83 e8 01             	sub    $0x1,%eax
80103610:	a3 3c 27 11 80       	mov    %eax,0x8011273c
  if(log.committing)
80103615:	a1 40 27 11 80       	mov    0x80112740,%eax
8010361a:	85 c0                	test   %eax,%eax
8010361c:	74 0d                	je     8010362b <end_op+0x40>
    panic("log.committing");
8010361e:	83 ec 0c             	sub    $0xc,%esp
80103621:	68 01 87 10 80       	push   $0x80108701
80103626:	e8 8a cf ff ff       	call   801005b5 <panic>
  if(log.outstanding == 0){
8010362b:	a1 3c 27 11 80       	mov    0x8011273c,%eax
80103630:	85 c0                	test   %eax,%eax
80103632:	75 13                	jne    80103647 <end_op+0x5c>
    do_commit = 1;
80103634:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
    log.committing = 1;
8010363b:	c7 05 40 27 11 80 01 	movl   $0x1,0x80112740
80103642:	00 00 00 
80103645:	eb 10                	jmp    80103657 <end_op+0x6c>
  } else {
    // begin_op() may be waiting for log space,
    // and decrementing log.outstanding has decreased
    // the amount of reserved space.
    wakeup(&log);
80103647:	83 ec 0c             	sub    $0xc,%esp
8010364a:	68 00 27 11 80       	push   $0x80112700
8010364f:	e8 32 16 00 00       	call   80104c86 <wakeup>
80103654:	83 c4 10             	add    $0x10,%esp
  }
  release(&log.lock);
80103657:	83 ec 0c             	sub    $0xc,%esp
8010365a:	68 00 27 11 80       	push   $0x80112700
8010365f:	e8 c4 19 00 00       	call   80105028 <release>
80103664:	83 c4 10             	add    $0x10,%esp

  if(do_commit){
80103667:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010366b:	74 3f                	je     801036ac <end_op+0xc1>
    // call commit w/o holding locks, since not allowed
    // to sleep with locks.
    commit();
8010366d:	e8 f6 00 00 00       	call   80103768 <commit>
    acquire(&log.lock);
80103672:	83 ec 0c             	sub    $0xc,%esp
80103675:	68 00 27 11 80       	push   $0x80112700
8010367a:	e8 3b 19 00 00       	call   80104fba <acquire>
8010367f:	83 c4 10             	add    $0x10,%esp
    log.committing = 0;
80103682:	c7 05 40 27 11 80 00 	movl   $0x0,0x80112740
80103689:	00 00 00 
    wakeup(&log);
8010368c:	83 ec 0c             	sub    $0xc,%esp
8010368f:	68 00 27 11 80       	push   $0x80112700
80103694:	e8 ed 15 00 00       	call   80104c86 <wakeup>
80103699:	83 c4 10             	add    $0x10,%esp
    release(&log.lock);
8010369c:	83 ec 0c             	sub    $0xc,%esp
8010369f:	68 00 27 11 80       	push   $0x80112700
801036a4:	e8 7f 19 00 00       	call   80105028 <release>
801036a9:	83 c4 10             	add    $0x10,%esp
  }
}
801036ac:	90                   	nop
801036ad:	c9                   	leave  
801036ae:	c3                   	ret    

801036af <write_log>:

// Copy modified blocks from cache to log.
static void
write_log(void)
{
801036af:	55                   	push   %ebp
801036b0:	89 e5                	mov    %esp,%ebp
801036b2:	83 ec 18             	sub    $0x18,%esp
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
801036b5:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801036bc:	e9 95 00 00 00       	jmp    80103756 <write_log+0xa7>
    struct buf *to = bread(log.dev, log.start+tail+1); // log block
801036c1:	8b 15 34 27 11 80    	mov    0x80112734,%edx
801036c7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801036ca:	01 d0                	add    %edx,%eax
801036cc:	83 c0 01             	add    $0x1,%eax
801036cf:	89 c2                	mov    %eax,%edx
801036d1:	a1 44 27 11 80       	mov    0x80112744,%eax
801036d6:	83 ec 08             	sub    $0x8,%esp
801036d9:	52                   	push   %edx
801036da:	50                   	push   %eax
801036db:	e8 ef ca ff ff       	call   801001cf <bread>
801036e0:	83 c4 10             	add    $0x10,%esp
801036e3:	89 45 f0             	mov    %eax,-0x10(%ebp)
    struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
801036e6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801036e9:	83 c0 10             	add    $0x10,%eax
801036ec:	8b 04 85 0c 27 11 80 	mov    -0x7feed8f4(,%eax,4),%eax
801036f3:	89 c2                	mov    %eax,%edx
801036f5:	a1 44 27 11 80       	mov    0x80112744,%eax
801036fa:	83 ec 08             	sub    $0x8,%esp
801036fd:	52                   	push   %edx
801036fe:	50                   	push   %eax
801036ff:	e8 cb ca ff ff       	call   801001cf <bread>
80103704:	83 c4 10             	add    $0x10,%esp
80103707:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(to->data, from->data, BSIZE);
8010370a:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010370d:	8d 50 5c             	lea    0x5c(%eax),%edx
80103710:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103713:	83 c0 5c             	add    $0x5c,%eax
80103716:	83 ec 04             	sub    $0x4,%esp
80103719:	68 00 02 00 00       	push   $0x200
8010371e:	52                   	push   %edx
8010371f:	50                   	push   %eax
80103720:	e8 ca 1b 00 00       	call   801052ef <memmove>
80103725:	83 c4 10             	add    $0x10,%esp
    bwrite(to);  // write the log
80103728:	83 ec 0c             	sub    $0xc,%esp
8010372b:	ff 75 f0             	push   -0x10(%ebp)
8010372e:	e8 d5 ca ff ff       	call   80100208 <bwrite>
80103733:	83 c4 10             	add    $0x10,%esp
    brelse(from);
80103736:	83 ec 0c             	sub    $0xc,%esp
80103739:	ff 75 ec             	push   -0x14(%ebp)
8010373c:	e8 10 cb ff ff       	call   80100251 <brelse>
80103741:	83 c4 10             	add    $0x10,%esp
    brelse(to);
80103744:	83 ec 0c             	sub    $0xc,%esp
80103747:	ff 75 f0             	push   -0x10(%ebp)
8010374a:	e8 02 cb ff ff       	call   80100251 <brelse>
8010374f:	83 c4 10             	add    $0x10,%esp
  for (tail = 0; tail < log.lh.n; tail++) {
80103752:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103756:	a1 48 27 11 80       	mov    0x80112748,%eax
8010375b:	39 45 f4             	cmp    %eax,-0xc(%ebp)
8010375e:	0f 8c 5d ff ff ff    	jl     801036c1 <write_log+0x12>
  }
}
80103764:	90                   	nop
80103765:	90                   	nop
80103766:	c9                   	leave  
80103767:	c3                   	ret    

80103768 <commit>:

static void
commit()
{
80103768:	55                   	push   %ebp
80103769:	89 e5                	mov    %esp,%ebp
8010376b:	83 ec 08             	sub    $0x8,%esp
  if (log.lh.n > 0) {
8010376e:	a1 48 27 11 80       	mov    0x80112748,%eax
80103773:	85 c0                	test   %eax,%eax
80103775:	7e 1e                	jle    80103795 <commit+0x2d>
    write_log();     // Write modified blocks from cache to log
80103777:	e8 33 ff ff ff       	call   801036af <write_log>
    write_head();    // Write header to disk -- the real commit
8010377c:	e8 39 fd ff ff       	call   801034ba <write_head>
    install_trans(); // Now install writes to home locations
80103781:	e8 07 fc ff ff       	call   8010338d <install_trans>
    log.lh.n = 0;
80103786:	c7 05 48 27 11 80 00 	movl   $0x0,0x80112748
8010378d:	00 00 00 
    write_head();    // Erase the transaction from the log
80103790:	e8 25 fd ff ff       	call   801034ba <write_head>
  }
}
80103795:	90                   	nop
80103796:	c9                   	leave  
80103797:	c3                   	ret    

80103798 <log_write>:
//   modify bp->data[]
//   log_write(bp)
//   brelse(bp)
void
log_write(struct buf *b)
{
80103798:	55                   	push   %ebp
80103799:	89 e5                	mov    %esp,%ebp
8010379b:	83 ec 18             	sub    $0x18,%esp
  int i;

  if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
8010379e:	a1 48 27 11 80       	mov    0x80112748,%eax
801037a3:	83 f8 1d             	cmp    $0x1d,%eax
801037a6:	7f 12                	jg     801037ba <log_write+0x22>
801037a8:	a1 48 27 11 80       	mov    0x80112748,%eax
801037ad:	8b 15 38 27 11 80    	mov    0x80112738,%edx
801037b3:	83 ea 01             	sub    $0x1,%edx
801037b6:	39 d0                	cmp    %edx,%eax
801037b8:	7c 0d                	jl     801037c7 <log_write+0x2f>
    panic("too big a transaction");
801037ba:	83 ec 0c             	sub    $0xc,%esp
801037bd:	68 10 87 10 80       	push   $0x80108710
801037c2:	e8 ee cd ff ff       	call   801005b5 <panic>
  if (log.outstanding < 1)
801037c7:	a1 3c 27 11 80       	mov    0x8011273c,%eax
801037cc:	85 c0                	test   %eax,%eax
801037ce:	7f 0d                	jg     801037dd <log_write+0x45>
    panic("log_write outside of trans");
801037d0:	83 ec 0c             	sub    $0xc,%esp
801037d3:	68 26 87 10 80       	push   $0x80108726
801037d8:	e8 d8 cd ff ff       	call   801005b5 <panic>

  acquire(&log.lock);
801037dd:	83 ec 0c             	sub    $0xc,%esp
801037e0:	68 00 27 11 80       	push   $0x80112700
801037e5:	e8 d0 17 00 00       	call   80104fba <acquire>
801037ea:	83 c4 10             	add    $0x10,%esp
  for (i = 0; i < log.lh.n; i++) {
801037ed:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801037f4:	eb 1d                	jmp    80103813 <log_write+0x7b>
    if (log.lh.block[i] == b->blockno)   // log absorbtion
801037f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801037f9:	83 c0 10             	add    $0x10,%eax
801037fc:	8b 04 85 0c 27 11 80 	mov    -0x7feed8f4(,%eax,4),%eax
80103803:	89 c2                	mov    %eax,%edx
80103805:	8b 45 08             	mov    0x8(%ebp),%eax
80103808:	8b 40 08             	mov    0x8(%eax),%eax
8010380b:	39 c2                	cmp    %eax,%edx
8010380d:	74 10                	je     8010381f <log_write+0x87>
  for (i = 0; i < log.lh.n; i++) {
8010380f:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103813:	a1 48 27 11 80       	mov    0x80112748,%eax
80103818:	39 45 f4             	cmp    %eax,-0xc(%ebp)
8010381b:	7c d9                	jl     801037f6 <log_write+0x5e>
8010381d:	eb 01                	jmp    80103820 <log_write+0x88>
      break;
8010381f:	90                   	nop
  }
  log.lh.block[i] = b->blockno;
80103820:	8b 45 08             	mov    0x8(%ebp),%eax
80103823:	8b 40 08             	mov    0x8(%eax),%eax
80103826:	89 c2                	mov    %eax,%edx
80103828:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010382b:	83 c0 10             	add    $0x10,%eax
8010382e:	89 14 85 0c 27 11 80 	mov    %edx,-0x7feed8f4(,%eax,4)
  if (i == log.lh.n)
80103835:	a1 48 27 11 80       	mov    0x80112748,%eax
8010383a:	39 45 f4             	cmp    %eax,-0xc(%ebp)
8010383d:	75 0d                	jne    8010384c <log_write+0xb4>
    log.lh.n++;
8010383f:	a1 48 27 11 80       	mov    0x80112748,%eax
80103844:	83 c0 01             	add    $0x1,%eax
80103847:	a3 48 27 11 80       	mov    %eax,0x80112748
  b->flags |= B_DIRTY; // prevent eviction
8010384c:	8b 45 08             	mov    0x8(%ebp),%eax
8010384f:	8b 00                	mov    (%eax),%eax
80103851:	83 c8 04             	or     $0x4,%eax
80103854:	89 c2                	mov    %eax,%edx
80103856:	8b 45 08             	mov    0x8(%ebp),%eax
80103859:	89 10                	mov    %edx,(%eax)
  release(&log.lock);
8010385b:	83 ec 0c             	sub    $0xc,%esp
8010385e:	68 00 27 11 80       	push   $0x80112700
80103863:	e8 c0 17 00 00       	call   80105028 <release>
80103868:	83 c4 10             	add    $0x10,%esp
}
8010386b:	90                   	nop
8010386c:	c9                   	leave  
8010386d:	c3                   	ret    

8010386e <xchg>:
  asm volatile("sti");
}

static inline uint
xchg(volatile uint *addr, uint newval)
{
8010386e:	55                   	push   %ebp
8010386f:	89 e5                	mov    %esp,%ebp
80103871:	83 ec 10             	sub    $0x10,%esp
  uint result;

  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80103874:	8b 55 08             	mov    0x8(%ebp),%edx
80103877:	8b 45 0c             	mov    0xc(%ebp),%eax
8010387a:	8b 4d 08             	mov    0x8(%ebp),%ecx
8010387d:	f0 87 02             	lock xchg %eax,(%edx)
80103880:	89 45 fc             	mov    %eax,-0x4(%ebp)
               "+m" (*addr), "=a" (result) :
               "1" (newval) :
               "cc");
  return result;
80103883:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80103886:	c9                   	leave  
80103887:	c3                   	ret    

80103888 <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
80103888:	8d 4c 24 04          	lea    0x4(%esp),%ecx
8010388c:	83 e4 f0             	and    $0xfffffff0,%esp
8010388f:	ff 71 fc             	push   -0x4(%ecx)
80103892:	55                   	push   %ebp
80103893:	89 e5                	mov    %esp,%ebp
80103895:	51                   	push   %ecx
80103896:	83 ec 04             	sub    $0x4,%esp
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
80103899:	83 ec 08             	sub    $0x8,%esp
8010389c:	68 00 00 40 80       	push   $0x80400000
801038a1:	68 00 65 11 80       	push   $0x80116500
801038a6:	e8 c9 f2 ff ff       	call   80102b74 <kinit1>
801038ab:	83 c4 10             	add    $0x10,%esp
  kvmalloc();      // kernel page table
801038ae:	e8 86 43 00 00       	call   80107c39 <kvmalloc>
  mpinit();        // detect other processors
801038b3:	e8 d3 03 00 00       	call   80103c8b <mpinit>
  lapicinit();     // interrupt controller
801038b8:	e8 41 f6 ff ff       	call   80102efe <lapicinit>
  seginit();       // segment descriptors
801038bd:	e8 62 3e 00 00       	call   80107724 <seginit>
  picinit();       // disable pic
801038c2:	e8 2b 05 00 00       	call   80103df2 <picinit>
  ioapicinit();    // another interrupt controller
801038c7:	e8 c3 f1 ff ff       	call   80102a8f <ioapicinit>
  consoleinit();   // console hardware
801038cc:	e8 a7 d2 ff ff       	call   80100b78 <consoleinit>
  uartinit();      // serial port
801038d1:	e8 d6 31 00 00       	call   80106aac <uartinit>
  pinit();         // process table
801038d6:	e8 50 09 00 00       	call   8010422b <pinit>
  tvinit();        // trap vectors
801038db:	e8 97 2d 00 00       	call   80106677 <tvinit>
  binit();         // buffer cache
801038e0:	e8 4f c7 ff ff       	call   80100034 <binit>
  fileinit();      // file table
801038e5:	e8 18 d7 ff ff       	call   80101002 <fileinit>
  ideinit();       // disk 
801038ea:	e8 77 ed ff ff       	call   80102666 <ideinit>
  startothers();   // start other processors
801038ef:	e8 96 00 00 00       	call   8010398a <startothers>
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
801038f4:	83 ec 08             	sub    $0x8,%esp
801038f7:	68 00 00 00 8e       	push   $0x8e000000
801038fc:	68 00 00 40 80       	push   $0x80400000
80103901:	e8 a7 f2 ff ff       	call   80102bad <kinit2>
80103906:	83 c4 10             	add    $0x10,%esp
  userinit();      // first user process
80103909:	e8 fb 0a 00 00       	call   80104409 <userinit>
  mpmain();        // finish this processor's setup
8010390e:	e8 1a 00 00 00       	call   8010392d <mpmain>

80103913 <mpenter>:
}

// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80103913:	55                   	push   %ebp
80103914:	89 e5                	mov    %esp,%ebp
80103916:	83 ec 08             	sub    $0x8,%esp
  switchkvm();
80103919:	e8 33 43 00 00       	call   80107c51 <switchkvm>
  seginit();
8010391e:	e8 01 3e 00 00       	call   80107724 <seginit>
  lapicinit();
80103923:	e8 d6 f5 ff ff       	call   80102efe <lapicinit>
  mpmain();
80103928:	e8 00 00 00 00       	call   8010392d <mpmain>

8010392d <mpmain>:

extern int free_frame_cnt;
// Common CPU setup code.
static void
mpmain(void)
{
8010392d:	55                   	push   %ebp
8010392e:	89 e5                	mov    %esp,%ebp
80103930:	53                   	push   %ebx
80103931:	83 ec 04             	sub    $0x4,%esp
  cprintf("cpu%d: starting %d\n", cpuid(), cpuid());
80103934:	e8 10 09 00 00       	call   80104249 <cpuid>
80103939:	89 c3                	mov    %eax,%ebx
8010393b:	e8 09 09 00 00       	call   80104249 <cpuid>
80103940:	83 ec 04             	sub    $0x4,%esp
80103943:	53                   	push   %ebx
80103944:	50                   	push   %eax
80103945:	68 41 87 10 80       	push   $0x80108741
8010394a:	e8 b1 ca ff ff       	call   80100400 <cprintf>
8010394f:	83 c4 10             	add    $0x10,%esp
  idtinit();       // load idt register
80103952:	e8 96 2e 00 00       	call   801067ed <idtinit>
  xchg(&(mycpu()->started), 1); // tell startothers() we're up
80103957:	e8 08 09 00 00       	call   80104264 <mycpu>
8010395c:	05 a0 00 00 00       	add    $0xa0,%eax
80103961:	83 ec 08             	sub    $0x8,%esp
80103964:	6a 01                	push   $0x1
80103966:	50                   	push   %eax
80103967:	e8 02 ff ff ff       	call   8010386e <xchg>
8010396c:	83 c4 10             	add    $0x10,%esp
  cprintf("number of free frames: %d \n",free_frame_cnt);
8010396f:	a1 80 26 11 80       	mov    0x80112680,%eax
80103974:	83 ec 08             	sub    $0x8,%esp
80103977:	50                   	push   %eax
80103978:	68 55 87 10 80       	push   $0x80108755
8010397d:	e8 7e ca ff ff       	call   80100400 <cprintf>
80103982:	83 c4 10             	add    $0x10,%esp
  scheduler();     // start running processes
80103985:	e8 24 10 00 00       	call   801049ae <scheduler>

8010398a <startothers>:
pde_t entrypgdir[];  // For entry.S

// Start the non-boot (AP) processors.
static void
startothers(void)
{
8010398a:	55                   	push   %ebp
8010398b:	89 e5                	mov    %esp,%ebp
8010398d:	83 ec 18             	sub    $0x18,%esp
  char *stack;

  // Write entry code to unused memory at 0x7000.
  // The linker has placed the image of entryother.S in
  // _binary_entryother_start.
  code = P2V(0x7000);
80103990:	c7 45 f0 00 70 00 80 	movl   $0x80007000,-0x10(%ebp)
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
80103997:	b8 8a 00 00 00       	mov    $0x8a,%eax
8010399c:	83 ec 04             	sub    $0x4,%esp
8010399f:	50                   	push   %eax
801039a0:	68 ec b4 10 80       	push   $0x8010b4ec
801039a5:	ff 75 f0             	push   -0x10(%ebp)
801039a8:	e8 42 19 00 00       	call   801052ef <memmove>
801039ad:	83 c4 10             	add    $0x10,%esp

  for(c = cpus; c < cpus+ncpu; c++){
801039b0:	c7 45 f4 e0 27 11 80 	movl   $0x801127e0,-0xc(%ebp)
801039b7:	eb 79                	jmp    80103a32 <startothers+0xa8>
    if(c == mycpu())  // We've started already.
801039b9:	e8 a6 08 00 00       	call   80104264 <mycpu>
801039be:	39 45 f4             	cmp    %eax,-0xc(%ebp)
801039c1:	74 67                	je     80103a2a <startothers+0xa0>
      continue;

    // Tell entryother.S what stack to use, where to enter, and what
    // pgdir to use. We cannot use kpgdir yet, because the AP processor
    // is running in low  memory, so we use entrypgdir for the APs too.
    stack = kalloc();
801039c3:	e8 ee f2 ff ff       	call   80102cb6 <kalloc>
801039c8:	89 45 ec             	mov    %eax,-0x14(%ebp)
    *(void**)(code-4) = stack + KSTACKSIZE;
801039cb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801039ce:	83 e8 04             	sub    $0x4,%eax
801039d1:	8b 55 ec             	mov    -0x14(%ebp),%edx
801039d4:	81 c2 00 10 00 00    	add    $0x1000,%edx
801039da:	89 10                	mov    %edx,(%eax)
    *(void**)(code-8) = mpenter;
801039dc:	8b 45 f0             	mov    -0x10(%ebp),%eax
801039df:	83 e8 08             	sub    $0x8,%eax
801039e2:	c7 00 13 39 10 80    	movl   $0x80103913,(%eax)
    *(int**)(code-12) = (void *) V2P(entrypgdir);
801039e8:	b8 00 a0 10 80       	mov    $0x8010a000,%eax
801039ed:	8d 90 00 00 00 80    	lea    -0x80000000(%eax),%edx
801039f3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801039f6:	83 e8 0c             	sub    $0xc,%eax
801039f9:	89 10                	mov    %edx,(%eax)

    lapicstartap(c->apicid, V2P(code));
801039fb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801039fe:	8d 90 00 00 00 80    	lea    -0x80000000(%eax),%edx
80103a04:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a07:	0f b6 00             	movzbl (%eax),%eax
80103a0a:	0f b6 c0             	movzbl %al,%eax
80103a0d:	83 ec 08             	sub    $0x8,%esp
80103a10:	52                   	push   %edx
80103a11:	50                   	push   %eax
80103a12:	e8 49 f6 ff ff       	call   80103060 <lapicstartap>
80103a17:	83 c4 10             	add    $0x10,%esp

    // wait for cpu to finish mpmain()
    while(c->started == 0)
80103a1a:	90                   	nop
80103a1b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a1e:	8b 80 a0 00 00 00    	mov    0xa0(%eax),%eax
80103a24:	85 c0                	test   %eax,%eax
80103a26:	74 f3                	je     80103a1b <startothers+0x91>
80103a28:	eb 01                	jmp    80103a2b <startothers+0xa1>
      continue;
80103a2a:	90                   	nop
  for(c = cpus; c < cpus+ncpu; c++){
80103a2b:	81 45 f4 b0 00 00 00 	addl   $0xb0,-0xc(%ebp)
80103a32:	a1 60 2d 11 80       	mov    0x80112d60,%eax
80103a37:	69 c0 b0 00 00 00    	imul   $0xb0,%eax,%eax
80103a3d:	05 e0 27 11 80       	add    $0x801127e0,%eax
80103a42:	39 45 f4             	cmp    %eax,-0xc(%ebp)
80103a45:	0f 82 6e ff ff ff    	jb     801039b9 <startothers+0x2f>
      ;
  }
}
80103a4b:	90                   	nop
80103a4c:	90                   	nop
80103a4d:	c9                   	leave  
80103a4e:	c3                   	ret    

80103a4f <inb>:
{
80103a4f:	55                   	push   %ebp
80103a50:	89 e5                	mov    %esp,%ebp
80103a52:	83 ec 14             	sub    $0x14,%esp
80103a55:	8b 45 08             	mov    0x8(%ebp),%eax
80103a58:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80103a5c:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
80103a60:	89 c2                	mov    %eax,%edx
80103a62:	ec                   	in     (%dx),%al
80103a63:	88 45 ff             	mov    %al,-0x1(%ebp)
  return data;
80103a66:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
}
80103a6a:	c9                   	leave  
80103a6b:	c3                   	ret    

80103a6c <outb>:
{
80103a6c:	55                   	push   %ebp
80103a6d:	89 e5                	mov    %esp,%ebp
80103a6f:	83 ec 08             	sub    $0x8,%esp
80103a72:	8b 45 08             	mov    0x8(%ebp),%eax
80103a75:	8b 55 0c             	mov    0xc(%ebp),%edx
80103a78:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
80103a7c:	89 d0                	mov    %edx,%eax
80103a7e:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103a81:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80103a85:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80103a89:	ee                   	out    %al,(%dx)
}
80103a8a:	90                   	nop
80103a8b:	c9                   	leave  
80103a8c:	c3                   	ret    

80103a8d <sum>:
int ncpu;
uchar ioapicid;

static uchar
sum(uchar *addr, int len)
{
80103a8d:	55                   	push   %ebp
80103a8e:	89 e5                	mov    %esp,%ebp
80103a90:	83 ec 10             	sub    $0x10,%esp
  int i, sum;

  sum = 0;
80103a93:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
  for(i=0; i<len; i++)
80103a9a:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
80103aa1:	eb 15                	jmp    80103ab8 <sum+0x2b>
    sum += addr[i];
80103aa3:	8b 55 fc             	mov    -0x4(%ebp),%edx
80103aa6:	8b 45 08             	mov    0x8(%ebp),%eax
80103aa9:	01 d0                	add    %edx,%eax
80103aab:	0f b6 00             	movzbl (%eax),%eax
80103aae:	0f b6 c0             	movzbl %al,%eax
80103ab1:	01 45 f8             	add    %eax,-0x8(%ebp)
  for(i=0; i<len; i++)
80103ab4:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80103ab8:	8b 45 fc             	mov    -0x4(%ebp),%eax
80103abb:	3b 45 0c             	cmp    0xc(%ebp),%eax
80103abe:	7c e3                	jl     80103aa3 <sum+0x16>
  return sum;
80103ac0:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80103ac3:	c9                   	leave  
80103ac4:	c3                   	ret    

80103ac5 <mpsearch1>:

// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80103ac5:	55                   	push   %ebp
80103ac6:	89 e5                	mov    %esp,%ebp
80103ac8:	83 ec 18             	sub    $0x18,%esp
  uchar *e, *p, *addr;

  addr = P2V(a);
80103acb:	8b 45 08             	mov    0x8(%ebp),%eax
80103ace:	05 00 00 00 80       	add    $0x80000000,%eax
80103ad3:	89 45 f0             	mov    %eax,-0x10(%ebp)
  e = addr+len;
80103ad6:	8b 55 0c             	mov    0xc(%ebp),%edx
80103ad9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103adc:	01 d0                	add    %edx,%eax
80103ade:	89 45 ec             	mov    %eax,-0x14(%ebp)
  for(p = addr; p < e; p += sizeof(struct mp))
80103ae1:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103ae4:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103ae7:	eb 36                	jmp    80103b1f <mpsearch1+0x5a>
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103ae9:	83 ec 04             	sub    $0x4,%esp
80103aec:	6a 04                	push   $0x4
80103aee:	68 74 87 10 80       	push   $0x80108774
80103af3:	ff 75 f4             	push   -0xc(%ebp)
80103af6:	e8 9c 17 00 00       	call   80105297 <memcmp>
80103afb:	83 c4 10             	add    $0x10,%esp
80103afe:	85 c0                	test   %eax,%eax
80103b00:	75 19                	jne    80103b1b <mpsearch1+0x56>
80103b02:	83 ec 08             	sub    $0x8,%esp
80103b05:	6a 10                	push   $0x10
80103b07:	ff 75 f4             	push   -0xc(%ebp)
80103b0a:	e8 7e ff ff ff       	call   80103a8d <sum>
80103b0f:	83 c4 10             	add    $0x10,%esp
80103b12:	84 c0                	test   %al,%al
80103b14:	75 05                	jne    80103b1b <mpsearch1+0x56>
      return (struct mp*)p;
80103b16:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103b19:	eb 11                	jmp    80103b2c <mpsearch1+0x67>
  for(p = addr; p < e; p += sizeof(struct mp))
80103b1b:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
80103b1f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103b22:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80103b25:	72 c2                	jb     80103ae9 <mpsearch1+0x24>
  return 0;
80103b27:	b8 00 00 00 00       	mov    $0x0,%eax
}
80103b2c:	c9                   	leave  
80103b2d:	c3                   	ret    

80103b2e <mpsearch>:
// 1) in the first KB of the EBDA;
// 2) in the last KB of system base memory;
// 3) in the BIOS ROM between 0xE0000 and 0xFFFFF.
static struct mp*
mpsearch(void)
{
80103b2e:	55                   	push   %ebp
80103b2f:	89 e5                	mov    %esp,%ebp
80103b31:	83 ec 18             	sub    $0x18,%esp
  uchar *bda;
  uint p;
  struct mp *mp;

  bda = (uchar *) P2V(0x400);
80103b34:	c7 45 f4 00 04 00 80 	movl   $0x80000400,-0xc(%ebp)
  if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103b3b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103b3e:	83 c0 0f             	add    $0xf,%eax
80103b41:	0f b6 00             	movzbl (%eax),%eax
80103b44:	0f b6 c0             	movzbl %al,%eax
80103b47:	c1 e0 08             	shl    $0x8,%eax
80103b4a:	89 c2                	mov    %eax,%edx
80103b4c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103b4f:	83 c0 0e             	add    $0xe,%eax
80103b52:	0f b6 00             	movzbl (%eax),%eax
80103b55:	0f b6 c0             	movzbl %al,%eax
80103b58:	09 d0                	or     %edx,%eax
80103b5a:	c1 e0 04             	shl    $0x4,%eax
80103b5d:	89 45 f0             	mov    %eax,-0x10(%ebp)
80103b60:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80103b64:	74 21                	je     80103b87 <mpsearch+0x59>
    if((mp = mpsearch1(p, 1024)))
80103b66:	83 ec 08             	sub    $0x8,%esp
80103b69:	68 00 04 00 00       	push   $0x400
80103b6e:	ff 75 f0             	push   -0x10(%ebp)
80103b71:	e8 4f ff ff ff       	call   80103ac5 <mpsearch1>
80103b76:	83 c4 10             	add    $0x10,%esp
80103b79:	89 45 ec             	mov    %eax,-0x14(%ebp)
80103b7c:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80103b80:	74 51                	je     80103bd3 <mpsearch+0xa5>
      return mp;
80103b82:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103b85:	eb 61                	jmp    80103be8 <mpsearch+0xba>
  } else {
    p = ((bda[0x14]<<8)|bda[0x13])*1024;
80103b87:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103b8a:	83 c0 14             	add    $0x14,%eax
80103b8d:	0f b6 00             	movzbl (%eax),%eax
80103b90:	0f b6 c0             	movzbl %al,%eax
80103b93:	c1 e0 08             	shl    $0x8,%eax
80103b96:	89 c2                	mov    %eax,%edx
80103b98:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103b9b:	83 c0 13             	add    $0x13,%eax
80103b9e:	0f b6 00             	movzbl (%eax),%eax
80103ba1:	0f b6 c0             	movzbl %al,%eax
80103ba4:	09 d0                	or     %edx,%eax
80103ba6:	c1 e0 0a             	shl    $0xa,%eax
80103ba9:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if((mp = mpsearch1(p-1024, 1024)))
80103bac:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103baf:	2d 00 04 00 00       	sub    $0x400,%eax
80103bb4:	83 ec 08             	sub    $0x8,%esp
80103bb7:	68 00 04 00 00       	push   $0x400
80103bbc:	50                   	push   %eax
80103bbd:	e8 03 ff ff ff       	call   80103ac5 <mpsearch1>
80103bc2:	83 c4 10             	add    $0x10,%esp
80103bc5:	89 45 ec             	mov    %eax,-0x14(%ebp)
80103bc8:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80103bcc:	74 05                	je     80103bd3 <mpsearch+0xa5>
      return mp;
80103bce:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103bd1:	eb 15                	jmp    80103be8 <mpsearch+0xba>
  }
  return mpsearch1(0xF0000, 0x10000);
80103bd3:	83 ec 08             	sub    $0x8,%esp
80103bd6:	68 00 00 01 00       	push   $0x10000
80103bdb:	68 00 00 0f 00       	push   $0xf0000
80103be0:	e8 e0 fe ff ff       	call   80103ac5 <mpsearch1>
80103be5:	83 c4 10             	add    $0x10,%esp
}
80103be8:	c9                   	leave  
80103be9:	c3                   	ret    

80103bea <mpconfig>:
// Check for correct signature, calculate the checksum and,
// if correct, check the version.
// To do: check extended table checksum.
static struct mpconf*
mpconfig(struct mp **pmp)
{
80103bea:	55                   	push   %ebp
80103beb:	89 e5                	mov    %esp,%ebp
80103bed:	83 ec 18             	sub    $0x18,%esp
  struct mpconf *conf;
  struct mp *mp;

  if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103bf0:	e8 39 ff ff ff       	call   80103b2e <mpsearch>
80103bf5:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103bf8:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103bfc:	74 0a                	je     80103c08 <mpconfig+0x1e>
80103bfe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103c01:	8b 40 04             	mov    0x4(%eax),%eax
80103c04:	85 c0                	test   %eax,%eax
80103c06:	75 07                	jne    80103c0f <mpconfig+0x25>
    return 0;
80103c08:	b8 00 00 00 00       	mov    $0x0,%eax
80103c0d:	eb 7a                	jmp    80103c89 <mpconfig+0x9f>
  conf = (struct mpconf*) P2V((uint) mp->physaddr);
80103c0f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103c12:	8b 40 04             	mov    0x4(%eax),%eax
80103c15:	05 00 00 00 80       	add    $0x80000000,%eax
80103c1a:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(memcmp(conf, "PCMP", 4) != 0)
80103c1d:	83 ec 04             	sub    $0x4,%esp
80103c20:	6a 04                	push   $0x4
80103c22:	68 79 87 10 80       	push   $0x80108779
80103c27:	ff 75 f0             	push   -0x10(%ebp)
80103c2a:	e8 68 16 00 00       	call   80105297 <memcmp>
80103c2f:	83 c4 10             	add    $0x10,%esp
80103c32:	85 c0                	test   %eax,%eax
80103c34:	74 07                	je     80103c3d <mpconfig+0x53>
    return 0;
80103c36:	b8 00 00 00 00       	mov    $0x0,%eax
80103c3b:	eb 4c                	jmp    80103c89 <mpconfig+0x9f>
  if(conf->version != 1 && conf->version != 4)
80103c3d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103c40:	0f b6 40 06          	movzbl 0x6(%eax),%eax
80103c44:	3c 01                	cmp    $0x1,%al
80103c46:	74 12                	je     80103c5a <mpconfig+0x70>
80103c48:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103c4b:	0f b6 40 06          	movzbl 0x6(%eax),%eax
80103c4f:	3c 04                	cmp    $0x4,%al
80103c51:	74 07                	je     80103c5a <mpconfig+0x70>
    return 0;
80103c53:	b8 00 00 00 00       	mov    $0x0,%eax
80103c58:	eb 2f                	jmp    80103c89 <mpconfig+0x9f>
  if(sum((uchar*)conf, conf->length) != 0)
80103c5a:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103c5d:	0f b7 40 04          	movzwl 0x4(%eax),%eax
80103c61:	0f b7 c0             	movzwl %ax,%eax
80103c64:	83 ec 08             	sub    $0x8,%esp
80103c67:	50                   	push   %eax
80103c68:	ff 75 f0             	push   -0x10(%ebp)
80103c6b:	e8 1d fe ff ff       	call   80103a8d <sum>
80103c70:	83 c4 10             	add    $0x10,%esp
80103c73:	84 c0                	test   %al,%al
80103c75:	74 07                	je     80103c7e <mpconfig+0x94>
    return 0;
80103c77:	b8 00 00 00 00       	mov    $0x0,%eax
80103c7c:	eb 0b                	jmp    80103c89 <mpconfig+0x9f>
  *pmp = mp;
80103c7e:	8b 45 08             	mov    0x8(%ebp),%eax
80103c81:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103c84:	89 10                	mov    %edx,(%eax)
  return conf;
80103c86:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80103c89:	c9                   	leave  
80103c8a:	c3                   	ret    

80103c8b <mpinit>:

void
mpinit(void)
{
80103c8b:	55                   	push   %ebp
80103c8c:	89 e5                	mov    %esp,%ebp
80103c8e:	83 ec 28             	sub    $0x28,%esp
  struct mp *mp;
  struct mpconf *conf;
  struct mpproc *proc;
  struct mpioapic *ioapic;

  if((conf = mpconfig(&mp)) == 0)
80103c91:	83 ec 0c             	sub    $0xc,%esp
80103c94:	8d 45 dc             	lea    -0x24(%ebp),%eax
80103c97:	50                   	push   %eax
80103c98:	e8 4d ff ff ff       	call   80103bea <mpconfig>
80103c9d:	83 c4 10             	add    $0x10,%esp
80103ca0:	89 45 ec             	mov    %eax,-0x14(%ebp)
80103ca3:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80103ca7:	75 0d                	jne    80103cb6 <mpinit+0x2b>
    panic("Expect to run on an SMP");
80103ca9:	83 ec 0c             	sub    $0xc,%esp
80103cac:	68 7e 87 10 80       	push   $0x8010877e
80103cb1:	e8 ff c8 ff ff       	call   801005b5 <panic>
  ismp = 1;
80103cb6:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
  lapic = (uint*)conf->lapicaddr;
80103cbd:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103cc0:	8b 40 24             	mov    0x24(%eax),%eax
80103cc3:	a3 e0 26 11 80       	mov    %eax,0x801126e0
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103cc8:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103ccb:	83 c0 2c             	add    $0x2c,%eax
80103cce:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103cd1:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103cd4:	0f b7 40 04          	movzwl 0x4(%eax),%eax
80103cd8:	0f b7 d0             	movzwl %ax,%edx
80103cdb:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103cde:	01 d0                	add    %edx,%eax
80103ce0:	89 45 e8             	mov    %eax,-0x18(%ebp)
80103ce3:	e9 8c 00 00 00       	jmp    80103d74 <mpinit+0xe9>
    switch(*p){
80103ce8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103ceb:	0f b6 00             	movzbl (%eax),%eax
80103cee:	0f b6 c0             	movzbl %al,%eax
80103cf1:	83 f8 04             	cmp    $0x4,%eax
80103cf4:	7f 76                	jg     80103d6c <mpinit+0xe1>
80103cf6:	83 f8 03             	cmp    $0x3,%eax
80103cf9:	7d 6b                	jge    80103d66 <mpinit+0xdb>
80103cfb:	83 f8 02             	cmp    $0x2,%eax
80103cfe:	74 4e                	je     80103d4e <mpinit+0xc3>
80103d00:	83 f8 02             	cmp    $0x2,%eax
80103d03:	7f 67                	jg     80103d6c <mpinit+0xe1>
80103d05:	85 c0                	test   %eax,%eax
80103d07:	74 07                	je     80103d10 <mpinit+0x85>
80103d09:	83 f8 01             	cmp    $0x1,%eax
80103d0c:	74 58                	je     80103d66 <mpinit+0xdb>
80103d0e:	eb 5c                	jmp    80103d6c <mpinit+0xe1>
    case MPPROC:
      proc = (struct mpproc*)p;
80103d10:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d13:	89 45 e0             	mov    %eax,-0x20(%ebp)
      if(ncpu < NCPU) {
80103d16:	a1 60 2d 11 80       	mov    0x80112d60,%eax
80103d1b:	83 f8 07             	cmp    $0x7,%eax
80103d1e:	7f 28                	jg     80103d48 <mpinit+0xbd>
        cpus[ncpu].apicid = proc->apicid;  // apicid may differ from ncpu
80103d20:	8b 15 60 2d 11 80    	mov    0x80112d60,%edx
80103d26:	8b 45 e0             	mov    -0x20(%ebp),%eax
80103d29:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103d2d:	69 d2 b0 00 00 00    	imul   $0xb0,%edx,%edx
80103d33:	81 c2 e0 27 11 80    	add    $0x801127e0,%edx
80103d39:	88 02                	mov    %al,(%edx)
        ncpu++;
80103d3b:	a1 60 2d 11 80       	mov    0x80112d60,%eax
80103d40:	83 c0 01             	add    $0x1,%eax
80103d43:	a3 60 2d 11 80       	mov    %eax,0x80112d60
      }
      p += sizeof(struct mpproc);
80103d48:	83 45 f4 14          	addl   $0x14,-0xc(%ebp)
      continue;
80103d4c:	eb 26                	jmp    80103d74 <mpinit+0xe9>
    case MPIOAPIC:
      ioapic = (struct mpioapic*)p;
80103d4e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d51:	89 45 e4             	mov    %eax,-0x1c(%ebp)
      ioapicid = ioapic->apicno;
80103d54:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80103d57:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103d5b:	a2 64 2d 11 80       	mov    %al,0x80112d64
      p += sizeof(struct mpioapic);
80103d60:	83 45 f4 08          	addl   $0x8,-0xc(%ebp)
      continue;
80103d64:	eb 0e                	jmp    80103d74 <mpinit+0xe9>
    case MPBUS:
    case MPIOINTR:
    case MPLINTR:
      p += 8;
80103d66:	83 45 f4 08          	addl   $0x8,-0xc(%ebp)
      continue;
80103d6a:	eb 08                	jmp    80103d74 <mpinit+0xe9>
    default:
      ismp = 0;
80103d6c:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
      break;
80103d73:	90                   	nop
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103d74:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d77:	3b 45 e8             	cmp    -0x18(%ebp),%eax
80103d7a:	0f 82 68 ff ff ff    	jb     80103ce8 <mpinit+0x5d>
    }
  }
  if(!ismp)
80103d80:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80103d84:	75 0d                	jne    80103d93 <mpinit+0x108>
    panic("Didn't find a suitable machine");
80103d86:	83 ec 0c             	sub    $0xc,%esp
80103d89:	68 98 87 10 80       	push   $0x80108798
80103d8e:	e8 22 c8 ff ff       	call   801005b5 <panic>

  if(mp->imcrp){
80103d93:	8b 45 dc             	mov    -0x24(%ebp),%eax
80103d96:	0f b6 40 0c          	movzbl 0xc(%eax),%eax
80103d9a:	84 c0                	test   %al,%al
80103d9c:	74 30                	je     80103dce <mpinit+0x143>
    // Bochs doesn't support IMCR, so this doesn't run on Bochs.
    // But it would on real hardware.
    outb(0x22, 0x70);   // Select IMCR
80103d9e:	83 ec 08             	sub    $0x8,%esp
80103da1:	6a 70                	push   $0x70
80103da3:	6a 22                	push   $0x22
80103da5:	e8 c2 fc ff ff       	call   80103a6c <outb>
80103daa:	83 c4 10             	add    $0x10,%esp
    outb(0x23, inb(0x23) | 1);  // Mask external interrupts.
80103dad:	83 ec 0c             	sub    $0xc,%esp
80103db0:	6a 23                	push   $0x23
80103db2:	e8 98 fc ff ff       	call   80103a4f <inb>
80103db7:	83 c4 10             	add    $0x10,%esp
80103dba:	83 c8 01             	or     $0x1,%eax
80103dbd:	0f b6 c0             	movzbl %al,%eax
80103dc0:	83 ec 08             	sub    $0x8,%esp
80103dc3:	50                   	push   %eax
80103dc4:	6a 23                	push   $0x23
80103dc6:	e8 a1 fc ff ff       	call   80103a6c <outb>
80103dcb:	83 c4 10             	add    $0x10,%esp
  }
}
80103dce:	90                   	nop
80103dcf:	c9                   	leave  
80103dd0:	c3                   	ret    

80103dd1 <outb>:
{
80103dd1:	55                   	push   %ebp
80103dd2:	89 e5                	mov    %esp,%ebp
80103dd4:	83 ec 08             	sub    $0x8,%esp
80103dd7:	8b 45 08             	mov    0x8(%ebp),%eax
80103dda:	8b 55 0c             	mov    0xc(%ebp),%edx
80103ddd:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
80103de1:	89 d0                	mov    %edx,%eax
80103de3:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103de6:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80103dea:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80103dee:	ee                   	out    %al,(%dx)
}
80103def:	90                   	nop
80103df0:	c9                   	leave  
80103df1:	c3                   	ret    

80103df2 <picinit>:
#define IO_PIC2         0xA0    // Slave (IRQs 8-15)

// Don't use the 8259A interrupt controllers.  Xv6 assumes SMP hardware.
void
picinit(void)
{
80103df2:	55                   	push   %ebp
80103df3:	89 e5                	mov    %esp,%ebp
  // mask all interrupts
  outb(IO_PIC1+1, 0xFF);
80103df5:	68 ff 00 00 00       	push   $0xff
80103dfa:	6a 21                	push   $0x21
80103dfc:	e8 d0 ff ff ff       	call   80103dd1 <outb>
80103e01:	83 c4 08             	add    $0x8,%esp
  outb(IO_PIC2+1, 0xFF);
80103e04:	68 ff 00 00 00       	push   $0xff
80103e09:	68 a1 00 00 00       	push   $0xa1
80103e0e:	e8 be ff ff ff       	call   80103dd1 <outb>
80103e13:	83 c4 08             	add    $0x8,%esp
}
80103e16:	90                   	nop
80103e17:	c9                   	leave  
80103e18:	c3                   	ret    

80103e19 <pipealloc>:
  int writeopen;  // write fd is still open
};

int
pipealloc(struct file **f0, struct file **f1)
{
80103e19:	55                   	push   %ebp
80103e1a:	89 e5                	mov    %esp,%ebp
80103e1c:	83 ec 18             	sub    $0x18,%esp
  struct pipe *p;

  p = 0;
80103e1f:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  *f0 = *f1 = 0;
80103e26:	8b 45 0c             	mov    0xc(%ebp),%eax
80103e29:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
80103e2f:	8b 45 0c             	mov    0xc(%ebp),%eax
80103e32:	8b 10                	mov    (%eax),%edx
80103e34:	8b 45 08             	mov    0x8(%ebp),%eax
80103e37:	89 10                	mov    %edx,(%eax)
  if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80103e39:	e8 e2 d1 ff ff       	call   80101020 <filealloc>
80103e3e:	8b 55 08             	mov    0x8(%ebp),%edx
80103e41:	89 02                	mov    %eax,(%edx)
80103e43:	8b 45 08             	mov    0x8(%ebp),%eax
80103e46:	8b 00                	mov    (%eax),%eax
80103e48:	85 c0                	test   %eax,%eax
80103e4a:	0f 84 c8 00 00 00    	je     80103f18 <pipealloc+0xff>
80103e50:	e8 cb d1 ff ff       	call   80101020 <filealloc>
80103e55:	8b 55 0c             	mov    0xc(%ebp),%edx
80103e58:	89 02                	mov    %eax,(%edx)
80103e5a:	8b 45 0c             	mov    0xc(%ebp),%eax
80103e5d:	8b 00                	mov    (%eax),%eax
80103e5f:	85 c0                	test   %eax,%eax
80103e61:	0f 84 b1 00 00 00    	je     80103f18 <pipealloc+0xff>
    goto bad;
  if((p = (struct pipe*)kalloc()) == 0)
80103e67:	e8 4a ee ff ff       	call   80102cb6 <kalloc>
80103e6c:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103e6f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103e73:	0f 84 a2 00 00 00    	je     80103f1b <pipealloc+0x102>
    goto bad;
  p->readopen = 1;
80103e79:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103e7c:	c7 80 3c 02 00 00 01 	movl   $0x1,0x23c(%eax)
80103e83:	00 00 00 
  p->writeopen = 1;
80103e86:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103e89:	c7 80 40 02 00 00 01 	movl   $0x1,0x240(%eax)
80103e90:	00 00 00 
  p->nwrite = 0;
80103e93:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103e96:	c7 80 38 02 00 00 00 	movl   $0x0,0x238(%eax)
80103e9d:	00 00 00 
  p->nread = 0;
80103ea0:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103ea3:	c7 80 34 02 00 00 00 	movl   $0x0,0x234(%eax)
80103eaa:	00 00 00 
  initlock(&p->lock, "pipe");
80103ead:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103eb0:	83 ec 08             	sub    $0x8,%esp
80103eb3:	68 b7 87 10 80       	push   $0x801087b7
80103eb8:	50                   	push   %eax
80103eb9:	e8 da 10 00 00       	call   80104f98 <initlock>
80103ebe:	83 c4 10             	add    $0x10,%esp
  (*f0)->type = FD_PIPE;
80103ec1:	8b 45 08             	mov    0x8(%ebp),%eax
80103ec4:	8b 00                	mov    (%eax),%eax
80103ec6:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f0)->readable = 1;
80103ecc:	8b 45 08             	mov    0x8(%ebp),%eax
80103ecf:	8b 00                	mov    (%eax),%eax
80103ed1:	c6 40 08 01          	movb   $0x1,0x8(%eax)
  (*f0)->writable = 0;
80103ed5:	8b 45 08             	mov    0x8(%ebp),%eax
80103ed8:	8b 00                	mov    (%eax),%eax
80103eda:	c6 40 09 00          	movb   $0x0,0x9(%eax)
  (*f0)->pipe = p;
80103ede:	8b 45 08             	mov    0x8(%ebp),%eax
80103ee1:	8b 00                	mov    (%eax),%eax
80103ee3:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103ee6:	89 50 0c             	mov    %edx,0xc(%eax)
  (*f1)->type = FD_PIPE;
80103ee9:	8b 45 0c             	mov    0xc(%ebp),%eax
80103eec:	8b 00                	mov    (%eax),%eax
80103eee:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f1)->readable = 0;
80103ef4:	8b 45 0c             	mov    0xc(%ebp),%eax
80103ef7:	8b 00                	mov    (%eax),%eax
80103ef9:	c6 40 08 00          	movb   $0x0,0x8(%eax)
  (*f1)->writable = 1;
80103efd:	8b 45 0c             	mov    0xc(%ebp),%eax
80103f00:	8b 00                	mov    (%eax),%eax
80103f02:	c6 40 09 01          	movb   $0x1,0x9(%eax)
  (*f1)->pipe = p;
80103f06:	8b 45 0c             	mov    0xc(%ebp),%eax
80103f09:	8b 00                	mov    (%eax),%eax
80103f0b:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103f0e:	89 50 0c             	mov    %edx,0xc(%eax)
  return 0;
80103f11:	b8 00 00 00 00       	mov    $0x0,%eax
80103f16:	eb 51                	jmp    80103f69 <pipealloc+0x150>
    goto bad;
80103f18:	90                   	nop
80103f19:	eb 01                	jmp    80103f1c <pipealloc+0x103>
    goto bad;
80103f1b:	90                   	nop

//PAGEBREAK: 20
 bad:
  if(p)
80103f1c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103f20:	74 0e                	je     80103f30 <pipealloc+0x117>
    kfree((char*)p);
80103f22:	83 ec 0c             	sub    $0xc,%esp
80103f25:	ff 75 f4             	push   -0xc(%ebp)
80103f28:	e8 e2 ec ff ff       	call   80102c0f <kfree>
80103f2d:	83 c4 10             	add    $0x10,%esp
  if(*f0)
80103f30:	8b 45 08             	mov    0x8(%ebp),%eax
80103f33:	8b 00                	mov    (%eax),%eax
80103f35:	85 c0                	test   %eax,%eax
80103f37:	74 11                	je     80103f4a <pipealloc+0x131>
    fileclose(*f0);
80103f39:	8b 45 08             	mov    0x8(%ebp),%eax
80103f3c:	8b 00                	mov    (%eax),%eax
80103f3e:	83 ec 0c             	sub    $0xc,%esp
80103f41:	50                   	push   %eax
80103f42:	e8 97 d1 ff ff       	call   801010de <fileclose>
80103f47:	83 c4 10             	add    $0x10,%esp
  if(*f1)
80103f4a:	8b 45 0c             	mov    0xc(%ebp),%eax
80103f4d:	8b 00                	mov    (%eax),%eax
80103f4f:	85 c0                	test   %eax,%eax
80103f51:	74 11                	je     80103f64 <pipealloc+0x14b>
    fileclose(*f1);
80103f53:	8b 45 0c             	mov    0xc(%ebp),%eax
80103f56:	8b 00                	mov    (%eax),%eax
80103f58:	83 ec 0c             	sub    $0xc,%esp
80103f5b:	50                   	push   %eax
80103f5c:	e8 7d d1 ff ff       	call   801010de <fileclose>
80103f61:	83 c4 10             	add    $0x10,%esp
  return -1;
80103f64:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80103f69:	c9                   	leave  
80103f6a:	c3                   	ret    

80103f6b <pipeclose>:

void
pipeclose(struct pipe *p, int writable)
{
80103f6b:	55                   	push   %ebp
80103f6c:	89 e5                	mov    %esp,%ebp
80103f6e:	83 ec 08             	sub    $0x8,%esp
  acquire(&p->lock);
80103f71:	8b 45 08             	mov    0x8(%ebp),%eax
80103f74:	83 ec 0c             	sub    $0xc,%esp
80103f77:	50                   	push   %eax
80103f78:	e8 3d 10 00 00       	call   80104fba <acquire>
80103f7d:	83 c4 10             	add    $0x10,%esp
  if(writable){
80103f80:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80103f84:	74 23                	je     80103fa9 <pipeclose+0x3e>
    p->writeopen = 0;
80103f86:	8b 45 08             	mov    0x8(%ebp),%eax
80103f89:	c7 80 40 02 00 00 00 	movl   $0x0,0x240(%eax)
80103f90:	00 00 00 
    wakeup(&p->nread);
80103f93:	8b 45 08             	mov    0x8(%ebp),%eax
80103f96:	05 34 02 00 00       	add    $0x234,%eax
80103f9b:	83 ec 0c             	sub    $0xc,%esp
80103f9e:	50                   	push   %eax
80103f9f:	e8 e2 0c 00 00       	call   80104c86 <wakeup>
80103fa4:	83 c4 10             	add    $0x10,%esp
80103fa7:	eb 21                	jmp    80103fca <pipeclose+0x5f>
  } else {
    p->readopen = 0;
80103fa9:	8b 45 08             	mov    0x8(%ebp),%eax
80103fac:	c7 80 3c 02 00 00 00 	movl   $0x0,0x23c(%eax)
80103fb3:	00 00 00 
    wakeup(&p->nwrite);
80103fb6:	8b 45 08             	mov    0x8(%ebp),%eax
80103fb9:	05 38 02 00 00       	add    $0x238,%eax
80103fbe:	83 ec 0c             	sub    $0xc,%esp
80103fc1:	50                   	push   %eax
80103fc2:	e8 bf 0c 00 00       	call   80104c86 <wakeup>
80103fc7:	83 c4 10             	add    $0x10,%esp
  }
  if(p->readopen == 0 && p->writeopen == 0){
80103fca:	8b 45 08             	mov    0x8(%ebp),%eax
80103fcd:	8b 80 3c 02 00 00    	mov    0x23c(%eax),%eax
80103fd3:	85 c0                	test   %eax,%eax
80103fd5:	75 2c                	jne    80104003 <pipeclose+0x98>
80103fd7:	8b 45 08             	mov    0x8(%ebp),%eax
80103fda:	8b 80 40 02 00 00    	mov    0x240(%eax),%eax
80103fe0:	85 c0                	test   %eax,%eax
80103fe2:	75 1f                	jne    80104003 <pipeclose+0x98>
    release(&p->lock);
80103fe4:	8b 45 08             	mov    0x8(%ebp),%eax
80103fe7:	83 ec 0c             	sub    $0xc,%esp
80103fea:	50                   	push   %eax
80103feb:	e8 38 10 00 00       	call   80105028 <release>
80103ff0:	83 c4 10             	add    $0x10,%esp
    kfree((char*)p);
80103ff3:	83 ec 0c             	sub    $0xc,%esp
80103ff6:	ff 75 08             	push   0x8(%ebp)
80103ff9:	e8 11 ec ff ff       	call   80102c0f <kfree>
80103ffe:	83 c4 10             	add    $0x10,%esp
80104001:	eb 10                	jmp    80104013 <pipeclose+0xa8>
  } else
    release(&p->lock);
80104003:	8b 45 08             	mov    0x8(%ebp),%eax
80104006:	83 ec 0c             	sub    $0xc,%esp
80104009:	50                   	push   %eax
8010400a:	e8 19 10 00 00       	call   80105028 <release>
8010400f:	83 c4 10             	add    $0x10,%esp
}
80104012:	90                   	nop
80104013:	90                   	nop
80104014:	c9                   	leave  
80104015:	c3                   	ret    

80104016 <pipewrite>:

//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80104016:	55                   	push   %ebp
80104017:	89 e5                	mov    %esp,%ebp
80104019:	53                   	push   %ebx
8010401a:	83 ec 14             	sub    $0x14,%esp
  int i;

  acquire(&p->lock);
8010401d:	8b 45 08             	mov    0x8(%ebp),%eax
80104020:	83 ec 0c             	sub    $0xc,%esp
80104023:	50                   	push   %eax
80104024:	e8 91 0f 00 00       	call   80104fba <acquire>
80104029:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i < n; i++){
8010402c:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104033:	e9 ad 00 00 00       	jmp    801040e5 <pipewrite+0xcf>
    while(p->nwrite == p->nread + PIPESIZE){  //DOC: pipewrite-full
      if(p->readopen == 0 || myproc()->killed){
80104038:	8b 45 08             	mov    0x8(%ebp),%eax
8010403b:	8b 80 3c 02 00 00    	mov    0x23c(%eax),%eax
80104041:	85 c0                	test   %eax,%eax
80104043:	74 0c                	je     80104051 <pipewrite+0x3b>
80104045:	e8 92 02 00 00       	call   801042dc <myproc>
8010404a:	8b 40 24             	mov    0x24(%eax),%eax
8010404d:	85 c0                	test   %eax,%eax
8010404f:	74 19                	je     8010406a <pipewrite+0x54>
        release(&p->lock);
80104051:	8b 45 08             	mov    0x8(%ebp),%eax
80104054:	83 ec 0c             	sub    $0xc,%esp
80104057:	50                   	push   %eax
80104058:	e8 cb 0f 00 00       	call   80105028 <release>
8010405d:	83 c4 10             	add    $0x10,%esp
        return -1;
80104060:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104065:	e9 a9 00 00 00       	jmp    80104113 <pipewrite+0xfd>
      }
      wakeup(&p->nread);
8010406a:	8b 45 08             	mov    0x8(%ebp),%eax
8010406d:	05 34 02 00 00       	add    $0x234,%eax
80104072:	83 ec 0c             	sub    $0xc,%esp
80104075:	50                   	push   %eax
80104076:	e8 0b 0c 00 00       	call   80104c86 <wakeup>
8010407b:	83 c4 10             	add    $0x10,%esp
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
8010407e:	8b 45 08             	mov    0x8(%ebp),%eax
80104081:	8b 55 08             	mov    0x8(%ebp),%edx
80104084:	81 c2 38 02 00 00    	add    $0x238,%edx
8010408a:	83 ec 08             	sub    $0x8,%esp
8010408d:	50                   	push   %eax
8010408e:	52                   	push   %edx
8010408f:	e8 0b 0b 00 00       	call   80104b9f <sleep>
80104094:	83 c4 10             	add    $0x10,%esp
    while(p->nwrite == p->nread + PIPESIZE){  //DOC: pipewrite-full
80104097:	8b 45 08             	mov    0x8(%ebp),%eax
8010409a:	8b 90 38 02 00 00    	mov    0x238(%eax),%edx
801040a0:	8b 45 08             	mov    0x8(%ebp),%eax
801040a3:	8b 80 34 02 00 00    	mov    0x234(%eax),%eax
801040a9:	05 00 02 00 00       	add    $0x200,%eax
801040ae:	39 c2                	cmp    %eax,%edx
801040b0:	74 86                	je     80104038 <pipewrite+0x22>
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
801040b2:	8b 55 f4             	mov    -0xc(%ebp),%edx
801040b5:	8b 45 0c             	mov    0xc(%ebp),%eax
801040b8:	8d 1c 02             	lea    (%edx,%eax,1),%ebx
801040bb:	8b 45 08             	mov    0x8(%ebp),%eax
801040be:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
801040c4:	8d 48 01             	lea    0x1(%eax),%ecx
801040c7:	8b 55 08             	mov    0x8(%ebp),%edx
801040ca:	89 8a 38 02 00 00    	mov    %ecx,0x238(%edx)
801040d0:	25 ff 01 00 00       	and    $0x1ff,%eax
801040d5:	89 c1                	mov    %eax,%ecx
801040d7:	0f b6 13             	movzbl (%ebx),%edx
801040da:	8b 45 08             	mov    0x8(%ebp),%eax
801040dd:	88 54 08 34          	mov    %dl,0x34(%eax,%ecx,1)
  for(i = 0; i < n; i++){
801040e1:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801040e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801040e8:	3b 45 10             	cmp    0x10(%ebp),%eax
801040eb:	7c aa                	jl     80104097 <pipewrite+0x81>
  }
  wakeup(&p->nread);  //DOC: pipewrite-wakeup1
801040ed:	8b 45 08             	mov    0x8(%ebp),%eax
801040f0:	05 34 02 00 00       	add    $0x234,%eax
801040f5:	83 ec 0c             	sub    $0xc,%esp
801040f8:	50                   	push   %eax
801040f9:	e8 88 0b 00 00       	call   80104c86 <wakeup>
801040fe:	83 c4 10             	add    $0x10,%esp
  release(&p->lock);
80104101:	8b 45 08             	mov    0x8(%ebp),%eax
80104104:	83 ec 0c             	sub    $0xc,%esp
80104107:	50                   	push   %eax
80104108:	e8 1b 0f 00 00       	call   80105028 <release>
8010410d:	83 c4 10             	add    $0x10,%esp
  return n;
80104110:	8b 45 10             	mov    0x10(%ebp),%eax
}
80104113:	8b 5d fc             	mov    -0x4(%ebp),%ebx
80104116:	c9                   	leave  
80104117:	c3                   	ret    

80104118 <piperead>:

int
piperead(struct pipe *p, char *addr, int n)
{
80104118:	55                   	push   %ebp
80104119:	89 e5                	mov    %esp,%ebp
8010411b:	83 ec 18             	sub    $0x18,%esp
  int i;

  acquire(&p->lock);
8010411e:	8b 45 08             	mov    0x8(%ebp),%eax
80104121:	83 ec 0c             	sub    $0xc,%esp
80104124:	50                   	push   %eax
80104125:	e8 90 0e 00 00       	call   80104fba <acquire>
8010412a:	83 c4 10             	add    $0x10,%esp
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
8010412d:	eb 3e                	jmp    8010416d <piperead+0x55>
    if(myproc()->killed){
8010412f:	e8 a8 01 00 00       	call   801042dc <myproc>
80104134:	8b 40 24             	mov    0x24(%eax),%eax
80104137:	85 c0                	test   %eax,%eax
80104139:	74 19                	je     80104154 <piperead+0x3c>
      release(&p->lock);
8010413b:	8b 45 08             	mov    0x8(%ebp),%eax
8010413e:	83 ec 0c             	sub    $0xc,%esp
80104141:	50                   	push   %eax
80104142:	e8 e1 0e 00 00       	call   80105028 <release>
80104147:	83 c4 10             	add    $0x10,%esp
      return -1;
8010414a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010414f:	e9 be 00 00 00       	jmp    80104212 <piperead+0xfa>
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
80104154:	8b 45 08             	mov    0x8(%ebp),%eax
80104157:	8b 55 08             	mov    0x8(%ebp),%edx
8010415a:	81 c2 34 02 00 00    	add    $0x234,%edx
80104160:	83 ec 08             	sub    $0x8,%esp
80104163:	50                   	push   %eax
80104164:	52                   	push   %edx
80104165:	e8 35 0a 00 00       	call   80104b9f <sleep>
8010416a:	83 c4 10             	add    $0x10,%esp
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
8010416d:	8b 45 08             	mov    0x8(%ebp),%eax
80104170:	8b 90 34 02 00 00    	mov    0x234(%eax),%edx
80104176:	8b 45 08             	mov    0x8(%ebp),%eax
80104179:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
8010417f:	39 c2                	cmp    %eax,%edx
80104181:	75 0d                	jne    80104190 <piperead+0x78>
80104183:	8b 45 08             	mov    0x8(%ebp),%eax
80104186:	8b 80 40 02 00 00    	mov    0x240(%eax),%eax
8010418c:	85 c0                	test   %eax,%eax
8010418e:	75 9f                	jne    8010412f <piperead+0x17>
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
80104190:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104197:	eb 48                	jmp    801041e1 <piperead+0xc9>
    if(p->nread == p->nwrite)
80104199:	8b 45 08             	mov    0x8(%ebp),%eax
8010419c:	8b 90 34 02 00 00    	mov    0x234(%eax),%edx
801041a2:	8b 45 08             	mov    0x8(%ebp),%eax
801041a5:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
801041ab:	39 c2                	cmp    %eax,%edx
801041ad:	74 3c                	je     801041eb <piperead+0xd3>
      break;
    addr[i] = p->data[p->nread++ % PIPESIZE];
801041af:	8b 45 08             	mov    0x8(%ebp),%eax
801041b2:	8b 80 34 02 00 00    	mov    0x234(%eax),%eax
801041b8:	8d 48 01             	lea    0x1(%eax),%ecx
801041bb:	8b 55 08             	mov    0x8(%ebp),%edx
801041be:	89 8a 34 02 00 00    	mov    %ecx,0x234(%edx)
801041c4:	25 ff 01 00 00       	and    $0x1ff,%eax
801041c9:	89 c1                	mov    %eax,%ecx
801041cb:	8b 55 f4             	mov    -0xc(%ebp),%edx
801041ce:	8b 45 0c             	mov    0xc(%ebp),%eax
801041d1:	01 c2                	add    %eax,%edx
801041d3:	8b 45 08             	mov    0x8(%ebp),%eax
801041d6:	0f b6 44 08 34       	movzbl 0x34(%eax,%ecx,1),%eax
801041db:	88 02                	mov    %al,(%edx)
  for(i = 0; i < n; i++){  //DOC: piperead-copy
801041dd:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801041e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041e4:	3b 45 10             	cmp    0x10(%ebp),%eax
801041e7:	7c b0                	jl     80104199 <piperead+0x81>
801041e9:	eb 01                	jmp    801041ec <piperead+0xd4>
      break;
801041eb:	90                   	nop
  }
  wakeup(&p->nwrite);  //DOC: piperead-wakeup
801041ec:	8b 45 08             	mov    0x8(%ebp),%eax
801041ef:	05 38 02 00 00       	add    $0x238,%eax
801041f4:	83 ec 0c             	sub    $0xc,%esp
801041f7:	50                   	push   %eax
801041f8:	e8 89 0a 00 00       	call   80104c86 <wakeup>
801041fd:	83 c4 10             	add    $0x10,%esp
  release(&p->lock);
80104200:	8b 45 08             	mov    0x8(%ebp),%eax
80104203:	83 ec 0c             	sub    $0xc,%esp
80104206:	50                   	push   %eax
80104207:	e8 1c 0e 00 00       	call   80105028 <release>
8010420c:	83 c4 10             	add    $0x10,%esp
  return i;
8010420f:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80104212:	c9                   	leave  
80104213:	c3                   	ret    

80104214 <readeflags>:
{
80104214:	55                   	push   %ebp
80104215:	89 e5                	mov    %esp,%ebp
80104217:	83 ec 10             	sub    $0x10,%esp
  asm volatile("pushfl; popl %0" : "=r" (eflags));
8010421a:	9c                   	pushf  
8010421b:	58                   	pop    %eax
8010421c:	89 45 fc             	mov    %eax,-0x4(%ebp)
  return eflags;
8010421f:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80104222:	c9                   	leave  
80104223:	c3                   	ret    

80104224 <sti>:
{
80104224:	55                   	push   %ebp
80104225:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
80104227:	fb                   	sti    
}
80104228:	90                   	nop
80104229:	5d                   	pop    %ebp
8010422a:	c3                   	ret    

8010422b <pinit>:

static void wakeup1(void *chan);

void
pinit(void)
{
8010422b:	55                   	push   %ebp
8010422c:	89 e5                	mov    %esp,%ebp
8010422e:	83 ec 08             	sub    $0x8,%esp
  initlock(&ptable.lock, "ptable");
80104231:	83 ec 08             	sub    $0x8,%esp
80104234:	68 bc 87 10 80       	push   $0x801087bc
80104239:	68 80 2d 11 80       	push   $0x80112d80
8010423e:	e8 55 0d 00 00       	call   80104f98 <initlock>
80104243:	83 c4 10             	add    $0x10,%esp
}
80104246:	90                   	nop
80104247:	c9                   	leave  
80104248:	c3                   	ret    

80104249 <cpuid>:

// Must be called with interrupts disabled
int
cpuid() {
80104249:	55                   	push   %ebp
8010424a:	89 e5                	mov    %esp,%ebp
8010424c:	83 ec 08             	sub    $0x8,%esp
  return mycpu()-cpus;
8010424f:	e8 10 00 00 00       	call   80104264 <mycpu>
80104254:	2d e0 27 11 80       	sub    $0x801127e0,%eax
80104259:	c1 f8 04             	sar    $0x4,%eax
8010425c:	69 c0 a3 8b 2e ba    	imul   $0xba2e8ba3,%eax,%eax
}
80104262:	c9                   	leave  
80104263:	c3                   	ret    

80104264 <mycpu>:

// Must be called with interrupts disabled to avoid the caller being
// rescheduled between reading lapicid and running through the loop.
struct cpu*
mycpu(void)
{
80104264:	55                   	push   %ebp
80104265:	89 e5                	mov    %esp,%ebp
80104267:	83 ec 18             	sub    $0x18,%esp
  int apicid, i;
  
  if(readeflags()&FL_IF)
8010426a:	e8 a5 ff ff ff       	call   80104214 <readeflags>
8010426f:	25 00 02 00 00       	and    $0x200,%eax
80104274:	85 c0                	test   %eax,%eax
80104276:	74 0d                	je     80104285 <mycpu+0x21>
    panic("mycpu called with interrupts enabled\n");
80104278:	83 ec 0c             	sub    $0xc,%esp
8010427b:	68 c4 87 10 80       	push   $0x801087c4
80104280:	e8 30 c3 ff ff       	call   801005b5 <panic>
  
  apicid = lapicid();
80104285:	e8 93 ed ff ff       	call   8010301d <lapicid>
8010428a:	89 45 f0             	mov    %eax,-0x10(%ebp)
  // APIC IDs are not guaranteed to be contiguous. Maybe we should have
  // a reverse map, or reserve a register to store &cpus[i].
  for (i = 0; i < ncpu; ++i) {
8010428d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104294:	eb 2d                	jmp    801042c3 <mycpu+0x5f>
    if (cpus[i].apicid == apicid)
80104296:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104299:	69 c0 b0 00 00 00    	imul   $0xb0,%eax,%eax
8010429f:	05 e0 27 11 80       	add    $0x801127e0,%eax
801042a4:	0f b6 00             	movzbl (%eax),%eax
801042a7:	0f b6 c0             	movzbl %al,%eax
801042aa:	39 45 f0             	cmp    %eax,-0x10(%ebp)
801042ad:	75 10                	jne    801042bf <mycpu+0x5b>
      return &cpus[i];
801042af:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042b2:	69 c0 b0 00 00 00    	imul   $0xb0,%eax,%eax
801042b8:	05 e0 27 11 80       	add    $0x801127e0,%eax
801042bd:	eb 1b                	jmp    801042da <mycpu+0x76>
  for (i = 0; i < ncpu; ++i) {
801042bf:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801042c3:	a1 60 2d 11 80       	mov    0x80112d60,%eax
801042c8:	39 45 f4             	cmp    %eax,-0xc(%ebp)
801042cb:	7c c9                	jl     80104296 <mycpu+0x32>
  }
  panic("unknown apicid\n");
801042cd:	83 ec 0c             	sub    $0xc,%esp
801042d0:	68 ea 87 10 80       	push   $0x801087ea
801042d5:	e8 db c2 ff ff       	call   801005b5 <panic>
}
801042da:	c9                   	leave  
801042db:	c3                   	ret    

801042dc <myproc>:

// Disable interrupts so that we are not rescheduled
// while reading proc from the cpu structure
struct proc*
myproc(void) {
801042dc:	55                   	push   %ebp
801042dd:	89 e5                	mov    %esp,%ebp
801042df:	83 ec 18             	sub    $0x18,%esp
  struct cpu *c;
  struct proc *p;
  pushcli();
801042e2:	e8 3e 0e 00 00       	call   80105125 <pushcli>
  c = mycpu();
801042e7:	e8 78 ff ff ff       	call   80104264 <mycpu>
801042ec:	89 45 f4             	mov    %eax,-0xc(%ebp)
  p = c->proc;
801042ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042f2:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
801042f8:	89 45 f0             	mov    %eax,-0x10(%ebp)
  popcli();
801042fb:	e8 72 0e 00 00       	call   80105172 <popcli>
  return p;
80104300:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80104303:	c9                   	leave  
80104304:	c3                   	ret    

80104305 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80104305:	55                   	push   %ebp
80104306:	89 e5                	mov    %esp,%ebp
80104308:	83 ec 18             	sub    $0x18,%esp
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);
8010430b:	83 ec 0c             	sub    $0xc,%esp
8010430e:	68 80 2d 11 80       	push   $0x80112d80
80104313:	e8 a2 0c 00 00       	call   80104fba <acquire>
80104318:	83 c4 10             	add    $0x10,%esp

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
8010431b:	c7 45 f4 b4 2d 11 80 	movl   $0x80112db4,-0xc(%ebp)
80104322:	eb 0e                	jmp    80104332 <allocproc+0x2d>
    if(p->state == UNUSED)
80104324:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104327:	8b 40 0c             	mov    0xc(%eax),%eax
8010432a:	85 c0                	test   %eax,%eax
8010432c:	74 27                	je     80104355 <allocproc+0x50>
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
8010432e:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104332:	81 7d f4 b4 4c 11 80 	cmpl   $0x80114cb4,-0xc(%ebp)
80104339:	72 e9                	jb     80104324 <allocproc+0x1f>
      goto found;

  release(&ptable.lock);
8010433b:	83 ec 0c             	sub    $0xc,%esp
8010433e:	68 80 2d 11 80       	push   $0x80112d80
80104343:	e8 e0 0c 00 00       	call   80105028 <release>
80104348:	83 c4 10             	add    $0x10,%esp
  return 0;
8010434b:	b8 00 00 00 00       	mov    $0x0,%eax
80104350:	e9 b2 00 00 00       	jmp    80104407 <allocproc+0x102>
      goto found;
80104355:	90                   	nop

found:
  p->state = EMBRYO;
80104356:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104359:	c7 40 0c 01 00 00 00 	movl   $0x1,0xc(%eax)
  p->pid = nextpid++;
80104360:	a1 00 b0 10 80       	mov    0x8010b000,%eax
80104365:	8d 50 01             	lea    0x1(%eax),%edx
80104368:	89 15 00 b0 10 80    	mov    %edx,0x8010b000
8010436e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104371:	89 42 10             	mov    %eax,0x10(%edx)

  release(&ptable.lock);
80104374:	83 ec 0c             	sub    $0xc,%esp
80104377:	68 80 2d 11 80       	push   $0x80112d80
8010437c:	e8 a7 0c 00 00       	call   80105028 <release>
80104381:	83 c4 10             	add    $0x10,%esp

  // Allocate kernel stack.
  if((p->kstack = kalloc()) == 0){
80104384:	e8 2d e9 ff ff       	call   80102cb6 <kalloc>
80104389:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010438c:	89 42 08             	mov    %eax,0x8(%edx)
8010438f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104392:	8b 40 08             	mov    0x8(%eax),%eax
80104395:	85 c0                	test   %eax,%eax
80104397:	75 11                	jne    801043aa <allocproc+0xa5>
    p->state = UNUSED;
80104399:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010439c:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    return 0;
801043a3:	b8 00 00 00 00       	mov    $0x0,%eax
801043a8:	eb 5d                	jmp    80104407 <allocproc+0x102>
  }
  sp = p->kstack + KSTACKSIZE;
801043aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801043ad:	8b 40 08             	mov    0x8(%eax),%eax
801043b0:	05 00 10 00 00       	add    $0x1000,%eax
801043b5:	89 45 f0             	mov    %eax,-0x10(%ebp)

  // Leave room for trap frame.
  sp -= sizeof *p->tf;
801043b8:	83 6d f0 4c          	subl   $0x4c,-0x10(%ebp)
  p->tf = (struct trapframe*)sp;
801043bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801043bf:	8b 55 f0             	mov    -0x10(%ebp),%edx
801043c2:	89 50 18             	mov    %edx,0x18(%eax)

  // Set up new context to start executing at forkret,
  // which returns to trapret.
  sp -= 4;
801043c5:	83 6d f0 04          	subl   $0x4,-0x10(%ebp)
  *(uint*)sp = (uint)trapret;
801043c9:	ba 31 66 10 80       	mov    $0x80106631,%edx
801043ce:	8b 45 f0             	mov    -0x10(%ebp),%eax
801043d1:	89 10                	mov    %edx,(%eax)

  sp -= sizeof *p->context;
801043d3:	83 6d f0 14          	subl   $0x14,-0x10(%ebp)
  p->context = (struct context*)sp;
801043d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801043da:	8b 55 f0             	mov    -0x10(%ebp),%edx
801043dd:	89 50 1c             	mov    %edx,0x1c(%eax)
  memset(p->context, 0, sizeof *p->context);
801043e0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801043e3:	8b 40 1c             	mov    0x1c(%eax),%eax
801043e6:	83 ec 04             	sub    $0x4,%esp
801043e9:	6a 14                	push   $0x14
801043eb:	6a 00                	push   $0x0
801043ed:	50                   	push   %eax
801043ee:	e8 3d 0e 00 00       	call   80105230 <memset>
801043f3:	83 c4 10             	add    $0x10,%esp
  p->context->eip = (uint)forkret;
801043f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801043f9:	8b 40 1c             	mov    0x1c(%eax),%eax
801043fc:	ba 59 4b 10 80       	mov    $0x80104b59,%edx
80104401:	89 50 10             	mov    %edx,0x10(%eax)

  return p;
80104404:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80104407:	c9                   	leave  
80104408:	c3                   	ret    

80104409 <userinit>:

//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
80104409:	55                   	push   %ebp
8010440a:	89 e5                	mov    %esp,%ebp
8010440c:	83 ec 18             	sub    $0x18,%esp
  struct proc *p;
  extern char _binary_initcode_start[], _binary_initcode_size[];

  p = allocproc();
8010440f:	e8 f1 fe ff ff       	call   80104305 <allocproc>
80104414:	89 45 f4             	mov    %eax,-0xc(%ebp)
  
  initproc = p;
80104417:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010441a:	a3 b8 4c 11 80       	mov    %eax,0x80114cb8
  if((p->pgdir = setupkvm()) == 0)
8010441f:	e8 7c 37 00 00       	call   80107ba0 <setupkvm>
80104424:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104427:	89 42 04             	mov    %eax,0x4(%edx)
8010442a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010442d:	8b 40 04             	mov    0x4(%eax),%eax
80104430:	85 c0                	test   %eax,%eax
80104432:	75 0d                	jne    80104441 <userinit+0x38>
    panic("userinit: out of memory?");
80104434:	83 ec 0c             	sub    $0xc,%esp
80104437:	68 fa 87 10 80       	push   $0x801087fa
8010443c:	e8 74 c1 ff ff       	call   801005b5 <panic>
  inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
80104441:	ba 2c 00 00 00       	mov    $0x2c,%edx
80104446:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104449:	8b 40 04             	mov    0x4(%eax),%eax
8010444c:	83 ec 04             	sub    $0x4,%esp
8010444f:	52                   	push   %edx
80104450:	68 c0 b4 10 80       	push   $0x8010b4c0
80104455:	50                   	push   %eax
80104456:	e8 ae 39 00 00       	call   80107e09 <inituvm>
8010445b:	83 c4 10             	add    $0x10,%esp
  p->sz = PGSIZE;
8010445e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104461:	c7 00 00 10 00 00    	movl   $0x1000,(%eax)
  memset(p->tf, 0, sizeof(*p->tf));
80104467:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010446a:	8b 40 18             	mov    0x18(%eax),%eax
8010446d:	83 ec 04             	sub    $0x4,%esp
80104470:	6a 4c                	push   $0x4c
80104472:	6a 00                	push   $0x0
80104474:	50                   	push   %eax
80104475:	e8 b6 0d 00 00       	call   80105230 <memset>
8010447a:	83 c4 10             	add    $0x10,%esp
  p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
8010447d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104480:	8b 40 18             	mov    0x18(%eax),%eax
80104483:	66 c7 40 3c 1b 00    	movw   $0x1b,0x3c(%eax)
  p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
80104489:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010448c:	8b 40 18             	mov    0x18(%eax),%eax
8010448f:	66 c7 40 2c 23 00    	movw   $0x23,0x2c(%eax)
  p->tf->es = p->tf->ds;
80104495:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104498:	8b 50 18             	mov    0x18(%eax),%edx
8010449b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010449e:	8b 40 18             	mov    0x18(%eax),%eax
801044a1:	0f b7 52 2c          	movzwl 0x2c(%edx),%edx
801044a5:	66 89 50 28          	mov    %dx,0x28(%eax)
  p->tf->ss = p->tf->ds;
801044a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801044ac:	8b 50 18             	mov    0x18(%eax),%edx
801044af:	8b 45 f4             	mov    -0xc(%ebp),%eax
801044b2:	8b 40 18             	mov    0x18(%eax),%eax
801044b5:	0f b7 52 2c          	movzwl 0x2c(%edx),%edx
801044b9:	66 89 50 48          	mov    %dx,0x48(%eax)
  p->tf->eflags = FL_IF;
801044bd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801044c0:	8b 40 18             	mov    0x18(%eax),%eax
801044c3:	c7 40 40 00 02 00 00 	movl   $0x200,0x40(%eax)
  p->tf->esp = PGSIZE;
801044ca:	8b 45 f4             	mov    -0xc(%ebp),%eax
801044cd:	8b 40 18             	mov    0x18(%eax),%eax
801044d0:	c7 40 44 00 10 00 00 	movl   $0x1000,0x44(%eax)
  p->tf->eip = 0;  // beginning of initcode.S
801044d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801044da:	8b 40 18             	mov    0x18(%eax),%eax
801044dd:	c7 40 38 00 00 00 00 	movl   $0x0,0x38(%eax)

  safestrcpy(p->name, "initcode", sizeof(p->name));
801044e4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801044e7:	83 c0 6c             	add    $0x6c,%eax
801044ea:	83 ec 04             	sub    $0x4,%esp
801044ed:	6a 10                	push   $0x10
801044ef:	68 13 88 10 80       	push   $0x80108813
801044f4:	50                   	push   %eax
801044f5:	e8 39 0f 00 00       	call   80105433 <safestrcpy>
801044fa:	83 c4 10             	add    $0x10,%esp
  p->cwd = namei("/");
801044fd:	83 ec 0c             	sub    $0xc,%esp
80104500:	68 1c 88 10 80       	push   $0x8010881c
80104505:	e8 56 e0 ff ff       	call   80102560 <namei>
8010450a:	83 c4 10             	add    $0x10,%esp
8010450d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104510:	89 42 68             	mov    %eax,0x68(%edx)

  // this assignment to p->state lets other cores
  // run this process. the acquire forces the above
  // writes to be visible, and the lock is also needed
  // because the assignment might not be atomic.
  acquire(&ptable.lock);
80104513:	83 ec 0c             	sub    $0xc,%esp
80104516:	68 80 2d 11 80       	push   $0x80112d80
8010451b:	e8 9a 0a 00 00       	call   80104fba <acquire>
80104520:	83 c4 10             	add    $0x10,%esp

  p->state = RUNNABLE;
80104523:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104526:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)

  release(&ptable.lock);
8010452d:	83 ec 0c             	sub    $0xc,%esp
80104530:	68 80 2d 11 80       	push   $0x80112d80
80104535:	e8 ee 0a 00 00       	call   80105028 <release>
8010453a:	83 c4 10             	add    $0x10,%esp
}
8010453d:	90                   	nop
8010453e:	c9                   	leave  
8010453f:	c3                   	ret    

80104540 <growproc>:

// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
80104540:	55                   	push   %ebp
80104541:	89 e5                	mov    %esp,%ebp
80104543:	83 ec 18             	sub    $0x18,%esp
  uint sz;
  struct proc *curproc = myproc();
80104546:	e8 91 fd ff ff       	call   801042dc <myproc>
8010454b:	89 45 f0             	mov    %eax,-0x10(%ebp)

  sz = curproc->sz;
8010454e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104551:	8b 00                	mov    (%eax),%eax
80104553:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(n > 0){
80104556:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010455a:	7e 2e                	jle    8010458a <growproc+0x4a>
    if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
8010455c:	8b 55 08             	mov    0x8(%ebp),%edx
8010455f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104562:	01 c2                	add    %eax,%edx
80104564:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104567:	8b 40 04             	mov    0x4(%eax),%eax
8010456a:	83 ec 04             	sub    $0x4,%esp
8010456d:	52                   	push   %edx
8010456e:	ff 75 f4             	push   -0xc(%ebp)
80104571:	50                   	push   %eax
80104572:	e8 cf 39 00 00       	call   80107f46 <allocuvm>
80104577:	83 c4 10             	add    $0x10,%esp
8010457a:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010457d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80104581:	75 3b                	jne    801045be <growproc+0x7e>
      return -1;
80104583:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104588:	eb 4f                	jmp    801045d9 <growproc+0x99>
  } else if(n < 0){
8010458a:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010458e:	79 2e                	jns    801045be <growproc+0x7e>
    if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
80104590:	8b 55 08             	mov    0x8(%ebp),%edx
80104593:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104596:	01 c2                	add    %eax,%edx
80104598:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010459b:	8b 40 04             	mov    0x4(%eax),%eax
8010459e:	83 ec 04             	sub    $0x4,%esp
801045a1:	52                   	push   %edx
801045a2:	ff 75 f4             	push   -0xc(%ebp)
801045a5:	50                   	push   %eax
801045a6:	e8 a0 3a 00 00       	call   8010804b <deallocuvm>
801045ab:	83 c4 10             	add    $0x10,%esp
801045ae:	89 45 f4             	mov    %eax,-0xc(%ebp)
801045b1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801045b5:	75 07                	jne    801045be <growproc+0x7e>
      return -1;
801045b7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801045bc:	eb 1b                	jmp    801045d9 <growproc+0x99>
  }
  curproc->sz = sz;
801045be:	8b 45 f0             	mov    -0x10(%ebp),%eax
801045c1:	8b 55 f4             	mov    -0xc(%ebp),%edx
801045c4:	89 10                	mov    %edx,(%eax)
  switchuvm(curproc);
801045c6:	83 ec 0c             	sub    $0xc,%esp
801045c9:	ff 75 f0             	push   -0x10(%ebp)
801045cc:	e8 99 36 00 00       	call   80107c6a <switchuvm>
801045d1:	83 c4 10             	add    $0x10,%esp
  return 0;
801045d4:	b8 00 00 00 00       	mov    $0x0,%eax
}
801045d9:	c9                   	leave  
801045da:	c3                   	ret    

801045db <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
801045db:	55                   	push   %ebp
801045dc:	89 e5                	mov    %esp,%ebp
801045de:	57                   	push   %edi
801045df:	56                   	push   %esi
801045e0:	53                   	push   %ebx
801045e1:	83 ec 1c             	sub    $0x1c,%esp
  int i, pid;
  struct proc *np;
  struct proc *curproc = myproc();
801045e4:	e8 f3 fc ff ff       	call   801042dc <myproc>
801045e9:	89 45 e0             	mov    %eax,-0x20(%ebp)

  // Allocate process.
  if((np = allocproc()) == 0){
801045ec:	e8 14 fd ff ff       	call   80104305 <allocproc>
801045f1:	89 45 dc             	mov    %eax,-0x24(%ebp)
801045f4:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
801045f8:	75 0a                	jne    80104604 <fork+0x29>
    return -1;
801045fa:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801045ff:	e9 62 01 00 00       	jmp    80104766 <fork+0x18b>
  }

  // Copy process state from proc.
  if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){
80104604:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104607:	8b 10                	mov    (%eax),%edx
80104609:	8b 45 e0             	mov    -0x20(%ebp),%eax
8010460c:	8b 40 04             	mov    0x4(%eax),%eax
8010460f:	83 ec 08             	sub    $0x8,%esp
80104612:	52                   	push   %edx
80104613:	50                   	push   %eax
80104614:	e8 d0 3b 00 00       	call   801081e9 <copyuvm>
80104619:	83 c4 10             	add    $0x10,%esp
8010461c:	8b 55 dc             	mov    -0x24(%ebp),%edx
8010461f:	89 42 04             	mov    %eax,0x4(%edx)
80104622:	8b 45 dc             	mov    -0x24(%ebp),%eax
80104625:	8b 40 04             	mov    0x4(%eax),%eax
80104628:	85 c0                	test   %eax,%eax
8010462a:	75 30                	jne    8010465c <fork+0x81>
    kfree(np->kstack);
8010462c:	8b 45 dc             	mov    -0x24(%ebp),%eax
8010462f:	8b 40 08             	mov    0x8(%eax),%eax
80104632:	83 ec 0c             	sub    $0xc,%esp
80104635:	50                   	push   %eax
80104636:	e8 d4 e5 ff ff       	call   80102c0f <kfree>
8010463b:	83 c4 10             	add    $0x10,%esp
    np->kstack = 0;
8010463e:	8b 45 dc             	mov    -0x24(%ebp),%eax
80104641:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
    np->state = UNUSED;
80104648:	8b 45 dc             	mov    -0x24(%ebp),%eax
8010464b:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    return -1;
80104652:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104657:	e9 0a 01 00 00       	jmp    80104766 <fork+0x18b>
  }
  np->sz = curproc->sz;
8010465c:	8b 45 e0             	mov    -0x20(%ebp),%eax
8010465f:	8b 10                	mov    (%eax),%edx
80104661:	8b 45 dc             	mov    -0x24(%ebp),%eax
80104664:	89 10                	mov    %edx,(%eax)
  np->parent = curproc;
80104666:	8b 45 dc             	mov    -0x24(%ebp),%eax
80104669:	8b 55 e0             	mov    -0x20(%ebp),%edx
8010466c:	89 50 14             	mov    %edx,0x14(%eax)
  *np->tf = *curproc->tf;
8010466f:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104672:	8b 48 18             	mov    0x18(%eax),%ecx
80104675:	8b 45 dc             	mov    -0x24(%ebp),%eax
80104678:	8b 40 18             	mov    0x18(%eax),%eax
8010467b:	89 c2                	mov    %eax,%edx
8010467d:	89 cb                	mov    %ecx,%ebx
8010467f:	b8 13 00 00 00       	mov    $0x13,%eax
80104684:	89 d7                	mov    %edx,%edi
80104686:	89 de                	mov    %ebx,%esi
80104688:	89 c1                	mov    %eax,%ecx
8010468a:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)

  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;
8010468c:	8b 45 dc             	mov    -0x24(%ebp),%eax
8010468f:	8b 40 18             	mov    0x18(%eax),%eax
80104692:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)

  for(i = 0; i < NOFILE; i++)
80104699:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
801046a0:	eb 3b                	jmp    801046dd <fork+0x102>
    if(curproc->ofile[i])
801046a2:	8b 45 e0             	mov    -0x20(%ebp),%eax
801046a5:	8b 55 e4             	mov    -0x1c(%ebp),%edx
801046a8:	83 c2 08             	add    $0x8,%edx
801046ab:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801046af:	85 c0                	test   %eax,%eax
801046b1:	74 26                	je     801046d9 <fork+0xfe>
      np->ofile[i] = filedup(curproc->ofile[i]);
801046b3:	8b 45 e0             	mov    -0x20(%ebp),%eax
801046b6:	8b 55 e4             	mov    -0x1c(%ebp),%edx
801046b9:	83 c2 08             	add    $0x8,%edx
801046bc:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801046c0:	83 ec 0c             	sub    $0xc,%esp
801046c3:	50                   	push   %eax
801046c4:	e8 c4 c9 ff ff       	call   8010108d <filedup>
801046c9:	83 c4 10             	add    $0x10,%esp
801046cc:	8b 55 dc             	mov    -0x24(%ebp),%edx
801046cf:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
801046d2:	83 c1 08             	add    $0x8,%ecx
801046d5:	89 44 8a 08          	mov    %eax,0x8(%edx,%ecx,4)
  for(i = 0; i < NOFILE; i++)
801046d9:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
801046dd:	83 7d e4 0f          	cmpl   $0xf,-0x1c(%ebp)
801046e1:	7e bf                	jle    801046a2 <fork+0xc7>
  np->cwd = idup(curproc->cwd);
801046e3:	8b 45 e0             	mov    -0x20(%ebp),%eax
801046e6:	8b 40 68             	mov    0x68(%eax),%eax
801046e9:	83 ec 0c             	sub    $0xc,%esp
801046ec:	50                   	push   %eax
801046ed:	e8 01 d3 ff ff       	call   801019f3 <idup>
801046f2:	83 c4 10             	add    $0x10,%esp
801046f5:	8b 55 dc             	mov    -0x24(%ebp),%edx
801046f8:	89 42 68             	mov    %eax,0x68(%edx)

  safestrcpy(np->name, curproc->name, sizeof(curproc->name));
801046fb:	8b 45 e0             	mov    -0x20(%ebp),%eax
801046fe:	8d 50 6c             	lea    0x6c(%eax),%edx
80104701:	8b 45 dc             	mov    -0x24(%ebp),%eax
80104704:	83 c0 6c             	add    $0x6c,%eax
80104707:	83 ec 04             	sub    $0x4,%esp
8010470a:	6a 10                	push   $0x10
8010470c:	52                   	push   %edx
8010470d:	50                   	push   %eax
8010470e:	e8 20 0d 00 00       	call   80105433 <safestrcpy>
80104713:	83 c4 10             	add    $0x10,%esp

  pid = np->pid;
80104716:	8b 45 dc             	mov    -0x24(%ebp),%eax
80104719:	8b 40 10             	mov    0x10(%eax),%eax
8010471c:	89 45 d8             	mov    %eax,-0x28(%ebp)

  acquire(&ptable.lock);
8010471f:	83 ec 0c             	sub    $0xc,%esp
80104722:	68 80 2d 11 80       	push   $0x80112d80
80104727:	e8 8e 08 00 00       	call   80104fba <acquire>
8010472c:	83 c4 10             	add    $0x10,%esp

  np->state = RUNNABLE;
8010472f:	8b 45 dc             	mov    -0x24(%ebp),%eax
80104732:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  
  if(fork_winner){
80104739:	a1 b4 4c 11 80       	mov    0x80114cb4,%eax
8010473e:	85 c0                	test   %eax,%eax
80104740:	74 11                	je     80104753 <fork+0x178>
    myproc()->state=RUNNABLE;
80104742:	e8 95 fb ff ff       	call   801042dc <myproc>
80104747:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
    sched();
8010474e:	e8 13 03 00 00       	call   80104a66 <sched>
  }

  release(&ptable.lock);
80104753:	83 ec 0c             	sub    $0xc,%esp
80104756:	68 80 2d 11 80       	push   $0x80112d80
8010475b:	e8 c8 08 00 00       	call   80105028 <release>
80104760:	83 c4 10             	add    $0x10,%esp

  return pid;
80104763:	8b 45 d8             	mov    -0x28(%ebp),%eax
}
80104766:	8d 65 f4             	lea    -0xc(%ebp),%esp
80104769:	5b                   	pop    %ebx
8010476a:	5e                   	pop    %esi
8010476b:	5f                   	pop    %edi
8010476c:	5d                   	pop    %ebp
8010476d:	c3                   	ret    

8010476e <exit>:
// Exit the current process.  Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
8010476e:	55                   	push   %ebp
8010476f:	89 e5                	mov    %esp,%ebp
80104771:	83 ec 18             	sub    $0x18,%esp
  struct proc *curproc = myproc();
80104774:	e8 63 fb ff ff       	call   801042dc <myproc>
80104779:	89 45 ec             	mov    %eax,-0x14(%ebp)
  struct proc *p;
  int fd;

  if(curproc == initproc)
8010477c:	a1 b8 4c 11 80       	mov    0x80114cb8,%eax
80104781:	39 45 ec             	cmp    %eax,-0x14(%ebp)
80104784:	75 0d                	jne    80104793 <exit+0x25>
    panic("init exiting");
80104786:	83 ec 0c             	sub    $0xc,%esp
80104789:	68 1e 88 10 80       	push   $0x8010881e
8010478e:	e8 22 be ff ff       	call   801005b5 <panic>

  // Close all open files.
  for(fd = 0; fd < NOFILE; fd++){
80104793:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
8010479a:	eb 3f                	jmp    801047db <exit+0x6d>
    if(curproc->ofile[fd]){
8010479c:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010479f:	8b 55 f0             	mov    -0x10(%ebp),%edx
801047a2:	83 c2 08             	add    $0x8,%edx
801047a5:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801047a9:	85 c0                	test   %eax,%eax
801047ab:	74 2a                	je     801047d7 <exit+0x69>
      fileclose(curproc->ofile[fd]);
801047ad:	8b 45 ec             	mov    -0x14(%ebp),%eax
801047b0:	8b 55 f0             	mov    -0x10(%ebp),%edx
801047b3:	83 c2 08             	add    $0x8,%edx
801047b6:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801047ba:	83 ec 0c             	sub    $0xc,%esp
801047bd:	50                   	push   %eax
801047be:	e8 1b c9 ff ff       	call   801010de <fileclose>
801047c3:	83 c4 10             	add    $0x10,%esp
      curproc->ofile[fd] = 0;
801047c6:	8b 45 ec             	mov    -0x14(%ebp),%eax
801047c9:	8b 55 f0             	mov    -0x10(%ebp),%edx
801047cc:	83 c2 08             	add    $0x8,%edx
801047cf:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
801047d6:	00 
  for(fd = 0; fd < NOFILE; fd++){
801047d7:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
801047db:	83 7d f0 0f          	cmpl   $0xf,-0x10(%ebp)
801047df:	7e bb                	jle    8010479c <exit+0x2e>
    }
  }

  begin_op();
801047e1:	e8 79 ed ff ff       	call   8010355f <begin_op>
  iput(curproc->cwd);
801047e6:	8b 45 ec             	mov    -0x14(%ebp),%eax
801047e9:	8b 40 68             	mov    0x68(%eax),%eax
801047ec:	83 ec 0c             	sub    $0xc,%esp
801047ef:	50                   	push   %eax
801047f0:	e8 99 d3 ff ff       	call   80101b8e <iput>
801047f5:	83 c4 10             	add    $0x10,%esp
  end_op();
801047f8:	e8 ee ed ff ff       	call   801035eb <end_op>
  curproc->cwd = 0;
801047fd:	8b 45 ec             	mov    -0x14(%ebp),%eax
80104800:	c7 40 68 00 00 00 00 	movl   $0x0,0x68(%eax)

  acquire(&ptable.lock);
80104807:	83 ec 0c             	sub    $0xc,%esp
8010480a:	68 80 2d 11 80       	push   $0x80112d80
8010480f:	e8 a6 07 00 00       	call   80104fba <acquire>
80104814:	83 c4 10             	add    $0x10,%esp

  // Parent might be sleeping in wait().
  wakeup1(curproc->parent);
80104817:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010481a:	8b 40 14             	mov    0x14(%eax),%eax
8010481d:	83 ec 0c             	sub    $0xc,%esp
80104820:	50                   	push   %eax
80104821:	e8 20 04 00 00       	call   80104c46 <wakeup1>
80104826:	83 c4 10             	add    $0x10,%esp

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104829:	c7 45 f4 b4 2d 11 80 	movl   $0x80112db4,-0xc(%ebp)
80104830:	eb 37                	jmp    80104869 <exit+0xfb>
    if(p->parent == curproc){
80104832:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104835:	8b 40 14             	mov    0x14(%eax),%eax
80104838:	39 45 ec             	cmp    %eax,-0x14(%ebp)
8010483b:	75 28                	jne    80104865 <exit+0xf7>
      p->parent = initproc;
8010483d:	8b 15 b8 4c 11 80    	mov    0x80114cb8,%edx
80104843:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104846:	89 50 14             	mov    %edx,0x14(%eax)
      if(p->state == ZOMBIE)
80104849:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010484c:	8b 40 0c             	mov    0xc(%eax),%eax
8010484f:	83 f8 05             	cmp    $0x5,%eax
80104852:	75 11                	jne    80104865 <exit+0xf7>
        wakeup1(initproc);
80104854:	a1 b8 4c 11 80       	mov    0x80114cb8,%eax
80104859:	83 ec 0c             	sub    $0xc,%esp
8010485c:	50                   	push   %eax
8010485d:	e8 e4 03 00 00       	call   80104c46 <wakeup1>
80104862:	83 c4 10             	add    $0x10,%esp
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104865:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104869:	81 7d f4 b4 4c 11 80 	cmpl   $0x80114cb4,-0xc(%ebp)
80104870:	72 c0                	jb     80104832 <exit+0xc4>
    }
  }

  // Jump into the scheduler, never to return.
  curproc->state = ZOMBIE;
80104872:	8b 45 ec             	mov    -0x14(%ebp),%eax
80104875:	c7 40 0c 05 00 00 00 	movl   $0x5,0xc(%eax)
  sched();
8010487c:	e8 e5 01 00 00       	call   80104a66 <sched>
  panic("zombie exit");
80104881:	83 ec 0c             	sub    $0xc,%esp
80104884:	68 2b 88 10 80       	push   $0x8010882b
80104889:	e8 27 bd ff ff       	call   801005b5 <panic>

8010488e <wait>:

// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
8010488e:	55                   	push   %ebp
8010488f:	89 e5                	mov    %esp,%ebp
80104891:	83 ec 18             	sub    $0x18,%esp
  struct proc *p;
  int havekids, pid;
  struct proc *curproc = myproc();
80104894:	e8 43 fa ff ff       	call   801042dc <myproc>
80104899:	89 45 ec             	mov    %eax,-0x14(%ebp)
  
  acquire(&ptable.lock);
8010489c:	83 ec 0c             	sub    $0xc,%esp
8010489f:	68 80 2d 11 80       	push   $0x80112d80
801048a4:	e8 11 07 00 00       	call   80104fba <acquire>
801048a9:	83 c4 10             	add    $0x10,%esp
  for(;;){
    // Scan through table looking for exited children.
    havekids = 0;
801048ac:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801048b3:	c7 45 f4 b4 2d 11 80 	movl   $0x80112db4,-0xc(%ebp)
801048ba:	e9 a1 00 00 00       	jmp    80104960 <wait+0xd2>
      if(p->parent != curproc)
801048bf:	8b 45 f4             	mov    -0xc(%ebp),%eax
801048c2:	8b 40 14             	mov    0x14(%eax),%eax
801048c5:	39 45 ec             	cmp    %eax,-0x14(%ebp)
801048c8:	0f 85 8d 00 00 00    	jne    8010495b <wait+0xcd>
        continue;
      havekids = 1;
801048ce:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
      if(p->state == ZOMBIE){
801048d5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801048d8:	8b 40 0c             	mov    0xc(%eax),%eax
801048db:	83 f8 05             	cmp    $0x5,%eax
801048de:	75 7c                	jne    8010495c <wait+0xce>
        // Found one.
        pid = p->pid;
801048e0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801048e3:	8b 40 10             	mov    0x10(%eax),%eax
801048e6:	89 45 e8             	mov    %eax,-0x18(%ebp)
        kfree(p->kstack);
801048e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801048ec:	8b 40 08             	mov    0x8(%eax),%eax
801048ef:	83 ec 0c             	sub    $0xc,%esp
801048f2:	50                   	push   %eax
801048f3:	e8 17 e3 ff ff       	call   80102c0f <kfree>
801048f8:	83 c4 10             	add    $0x10,%esp
        p->kstack = 0;
801048fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801048fe:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        freevm(p->pgdir);
80104905:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104908:	8b 40 04             	mov    0x4(%eax),%eax
8010490b:	83 ec 0c             	sub    $0xc,%esp
8010490e:	50                   	push   %eax
8010490f:	e8 fb 37 00 00       	call   8010810f <freevm>
80104914:	83 c4 10             	add    $0x10,%esp
        p->pid = 0;
80104917:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010491a:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        p->parent = 0;
80104921:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104924:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
        p->name[0] = 0;
8010492b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010492e:	c6 40 6c 00          	movb   $0x0,0x6c(%eax)
        p->killed = 0;
80104932:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104935:	c7 40 24 00 00 00 00 	movl   $0x0,0x24(%eax)
        p->state = UNUSED;
8010493c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010493f:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        release(&ptable.lock);
80104946:	83 ec 0c             	sub    $0xc,%esp
80104949:	68 80 2d 11 80       	push   $0x80112d80
8010494e:	e8 d5 06 00 00       	call   80105028 <release>
80104953:	83 c4 10             	add    $0x10,%esp
        return pid;
80104956:	8b 45 e8             	mov    -0x18(%ebp),%eax
80104959:	eb 51                	jmp    801049ac <wait+0x11e>
        continue;
8010495b:	90                   	nop
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010495c:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104960:	81 7d f4 b4 4c 11 80 	cmpl   $0x80114cb4,-0xc(%ebp)
80104967:	0f 82 52 ff ff ff    	jb     801048bf <wait+0x31>
      }
    }

    // No point waiting if we don't have any children.
    if(!havekids || curproc->killed){
8010496d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80104971:	74 0a                	je     8010497d <wait+0xef>
80104973:	8b 45 ec             	mov    -0x14(%ebp),%eax
80104976:	8b 40 24             	mov    0x24(%eax),%eax
80104979:	85 c0                	test   %eax,%eax
8010497b:	74 17                	je     80104994 <wait+0x106>
      release(&ptable.lock);
8010497d:	83 ec 0c             	sub    $0xc,%esp
80104980:	68 80 2d 11 80       	push   $0x80112d80
80104985:	e8 9e 06 00 00       	call   80105028 <release>
8010498a:	83 c4 10             	add    $0x10,%esp
      return -1;
8010498d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104992:	eb 18                	jmp    801049ac <wait+0x11e>
    }

    // Wait for children to exit.  (See wakeup1 call in proc_exit.)
    sleep(curproc, &ptable.lock);  //DOC: wait-sleep
80104994:	83 ec 08             	sub    $0x8,%esp
80104997:	68 80 2d 11 80       	push   $0x80112d80
8010499c:	ff 75 ec             	push   -0x14(%ebp)
8010499f:	e8 fb 01 00 00       	call   80104b9f <sleep>
801049a4:	83 c4 10             	add    $0x10,%esp
    havekids = 0;
801049a7:	e9 00 ff ff ff       	jmp    801048ac <wait+0x1e>
  }
}
801049ac:	c9                   	leave  
801049ad:	c3                   	ret    

801049ae <scheduler>:
//  - swtch to start running that process
//  - eventually that process transfers control
//      via swtch back to the scheduler.
void
scheduler(void)
{
801049ae:	55                   	push   %ebp
801049af:	89 e5                	mov    %esp,%ebp
801049b1:	83 ec 18             	sub    $0x18,%esp
  struct proc *p;
  struct cpu *c = mycpu();
801049b4:	e8 ab f8 ff ff       	call   80104264 <mycpu>
801049b9:	89 45 f0             	mov    %eax,-0x10(%ebp)
  c->proc = 0;
801049bc:	8b 45 f0             	mov    -0x10(%ebp),%eax
801049bf:	c7 80 ac 00 00 00 00 	movl   $0x0,0xac(%eax)
801049c6:	00 00 00 
  
  for(;;){
    // Enable interrupts on this processor.
    sti();
801049c9:	e8 56 f8 ff ff       	call   80104224 <sti>

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
801049ce:	83 ec 0c             	sub    $0xc,%esp
801049d1:	68 80 2d 11 80       	push   $0x80112d80
801049d6:	e8 df 05 00 00       	call   80104fba <acquire>
801049db:	83 c4 10             	add    $0x10,%esp
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801049de:	c7 45 f4 b4 2d 11 80 	movl   $0x80112db4,-0xc(%ebp)
801049e5:	eb 61                	jmp    80104a48 <scheduler+0x9a>
      if(p->state != RUNNABLE)
801049e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801049ea:	8b 40 0c             	mov    0xc(%eax),%eax
801049ed:	83 f8 03             	cmp    $0x3,%eax
801049f0:	75 51                	jne    80104a43 <scheduler+0x95>
        continue;

      // Switch to chosen process.  It is the process's job
      // to release ptable.lock and then reacquire it
      // before jumping back to us.
      c->proc = p;
801049f2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801049f5:	8b 55 f4             	mov    -0xc(%ebp),%edx
801049f8:	89 90 ac 00 00 00    	mov    %edx,0xac(%eax)
      switchuvm(p);
801049fe:	83 ec 0c             	sub    $0xc,%esp
80104a01:	ff 75 f4             	push   -0xc(%ebp)
80104a04:	e8 61 32 00 00       	call   80107c6a <switchuvm>
80104a09:	83 c4 10             	add    $0x10,%esp
      p->state = RUNNING;
80104a0c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104a0f:	c7 40 0c 04 00 00 00 	movl   $0x4,0xc(%eax)

      swtch(&(c->scheduler), p->context);
80104a16:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104a19:	8b 40 1c             	mov    0x1c(%eax),%eax
80104a1c:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104a1f:	83 c2 04             	add    $0x4,%edx
80104a22:	83 ec 08             	sub    $0x8,%esp
80104a25:	50                   	push   %eax
80104a26:	52                   	push   %edx
80104a27:	e8 79 0a 00 00       	call   801054a5 <swtch>
80104a2c:	83 c4 10             	add    $0x10,%esp
      switchkvm();
80104a2f:	e8 1d 32 00 00       	call   80107c51 <switchkvm>

      // Process is done running for now.
      // It should have changed its p->state before coming back.
      c->proc = 0;
80104a34:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104a37:	c7 80 ac 00 00 00 00 	movl   $0x0,0xac(%eax)
80104a3e:	00 00 00 
80104a41:	eb 01                	jmp    80104a44 <scheduler+0x96>
        continue;
80104a43:	90                   	nop
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104a44:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104a48:	81 7d f4 b4 4c 11 80 	cmpl   $0x80114cb4,-0xc(%ebp)
80104a4f:	72 96                	jb     801049e7 <scheduler+0x39>
    }
    release(&ptable.lock);
80104a51:	83 ec 0c             	sub    $0xc,%esp
80104a54:	68 80 2d 11 80       	push   $0x80112d80
80104a59:	e8 ca 05 00 00       	call   80105028 <release>
80104a5e:	83 c4 10             	add    $0x10,%esp
    sti();
80104a61:	e9 63 ff ff ff       	jmp    801049c9 <scheduler+0x1b>

80104a66 <sched>:
// be proc->intena and proc->ncli, but that would
// break in the few places where a lock is held but
// there's no process.
void
sched(void)
{
80104a66:	55                   	push   %ebp
80104a67:	89 e5                	mov    %esp,%ebp
80104a69:	83 ec 18             	sub    $0x18,%esp
  int intena;
  struct proc *p = myproc();
80104a6c:	e8 6b f8 ff ff       	call   801042dc <myproc>
80104a71:	89 45 f4             	mov    %eax,-0xc(%ebp)

  if(!holding(&ptable.lock))
80104a74:	83 ec 0c             	sub    $0xc,%esp
80104a77:	68 80 2d 11 80       	push   $0x80112d80
80104a7c:	e8 74 06 00 00       	call   801050f5 <holding>
80104a81:	83 c4 10             	add    $0x10,%esp
80104a84:	85 c0                	test   %eax,%eax
80104a86:	75 0d                	jne    80104a95 <sched+0x2f>
    panic("sched ptable.lock");
80104a88:	83 ec 0c             	sub    $0xc,%esp
80104a8b:	68 37 88 10 80       	push   $0x80108837
80104a90:	e8 20 bb ff ff       	call   801005b5 <panic>
  if(mycpu()->ncli != 1)
80104a95:	e8 ca f7 ff ff       	call   80104264 <mycpu>
80104a9a:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
80104aa0:	83 f8 01             	cmp    $0x1,%eax
80104aa3:	74 0d                	je     80104ab2 <sched+0x4c>
    panic("sched locks");
80104aa5:	83 ec 0c             	sub    $0xc,%esp
80104aa8:	68 49 88 10 80       	push   $0x80108849
80104aad:	e8 03 bb ff ff       	call   801005b5 <panic>
  if(p->state == RUNNING)
80104ab2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104ab5:	8b 40 0c             	mov    0xc(%eax),%eax
80104ab8:	83 f8 04             	cmp    $0x4,%eax
80104abb:	75 0d                	jne    80104aca <sched+0x64>
    panic("sched running");
80104abd:	83 ec 0c             	sub    $0xc,%esp
80104ac0:	68 55 88 10 80       	push   $0x80108855
80104ac5:	e8 eb ba ff ff       	call   801005b5 <panic>
  if(readeflags()&FL_IF)
80104aca:	e8 45 f7 ff ff       	call   80104214 <readeflags>
80104acf:	25 00 02 00 00       	and    $0x200,%eax
80104ad4:	85 c0                	test   %eax,%eax
80104ad6:	74 0d                	je     80104ae5 <sched+0x7f>
    panic("sched interruptible");
80104ad8:	83 ec 0c             	sub    $0xc,%esp
80104adb:	68 63 88 10 80       	push   $0x80108863
80104ae0:	e8 d0 ba ff ff       	call   801005b5 <panic>
  intena = mycpu()->intena;
80104ae5:	e8 7a f7 ff ff       	call   80104264 <mycpu>
80104aea:	8b 80 a8 00 00 00    	mov    0xa8(%eax),%eax
80104af0:	89 45 f0             	mov    %eax,-0x10(%ebp)
  swtch(&p->context, mycpu()->scheduler);
80104af3:	e8 6c f7 ff ff       	call   80104264 <mycpu>
80104af8:	8b 40 04             	mov    0x4(%eax),%eax
80104afb:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104afe:	83 c2 1c             	add    $0x1c,%edx
80104b01:	83 ec 08             	sub    $0x8,%esp
80104b04:	50                   	push   %eax
80104b05:	52                   	push   %edx
80104b06:	e8 9a 09 00 00       	call   801054a5 <swtch>
80104b0b:	83 c4 10             	add    $0x10,%esp
  mycpu()->intena = intena;
80104b0e:	e8 51 f7 ff ff       	call   80104264 <mycpu>
80104b13:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104b16:	89 90 a8 00 00 00    	mov    %edx,0xa8(%eax)
}
80104b1c:	90                   	nop
80104b1d:	c9                   	leave  
80104b1e:	c3                   	ret    

80104b1f <yield>:

// Give up the CPU for one scheduling round.
void
yield(void)
{
80104b1f:	55                   	push   %ebp
80104b20:	89 e5                	mov    %esp,%ebp
80104b22:	83 ec 08             	sub    $0x8,%esp
  acquire(&ptable.lock);  //DOC: yieldlock
80104b25:	83 ec 0c             	sub    $0xc,%esp
80104b28:	68 80 2d 11 80       	push   $0x80112d80
80104b2d:	e8 88 04 00 00       	call   80104fba <acquire>
80104b32:	83 c4 10             	add    $0x10,%esp
  myproc()->state = RUNNABLE;
80104b35:	e8 a2 f7 ff ff       	call   801042dc <myproc>
80104b3a:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  sched();
80104b41:	e8 20 ff ff ff       	call   80104a66 <sched>
  release(&ptable.lock);
80104b46:	83 ec 0c             	sub    $0xc,%esp
80104b49:	68 80 2d 11 80       	push   $0x80112d80
80104b4e:	e8 d5 04 00 00       	call   80105028 <release>
80104b53:	83 c4 10             	add    $0x10,%esp
}
80104b56:	90                   	nop
80104b57:	c9                   	leave  
80104b58:	c3                   	ret    

80104b59 <forkret>:

// A fork child's very first scheduling by scheduler()
// will swtch here.  "Return" to user space.
void
forkret(void)
{
80104b59:	55                   	push   %ebp
80104b5a:	89 e5                	mov    %esp,%ebp
80104b5c:	83 ec 08             	sub    $0x8,%esp
  static int first = 1;
  // Still holding ptable.lock from scheduler.
  release(&ptable.lock);
80104b5f:	83 ec 0c             	sub    $0xc,%esp
80104b62:	68 80 2d 11 80       	push   $0x80112d80
80104b67:	e8 bc 04 00 00       	call   80105028 <release>
80104b6c:	83 c4 10             	add    $0x10,%esp

  if (first) {
80104b6f:	a1 04 b0 10 80       	mov    0x8010b004,%eax
80104b74:	85 c0                	test   %eax,%eax
80104b76:	74 24                	je     80104b9c <forkret+0x43>
    // Some initialization functions must be run in the context
    // of a regular process (e.g., they call sleep), and thus cannot
    // be run from main().
    first = 0;
80104b78:	c7 05 04 b0 10 80 00 	movl   $0x0,0x8010b004
80104b7f:	00 00 00 
    iinit(ROOTDEV);
80104b82:	83 ec 0c             	sub    $0xc,%esp
80104b85:	6a 01                	push   $0x1
80104b87:	e8 2f cb ff ff       	call   801016bb <iinit>
80104b8c:	83 c4 10             	add    $0x10,%esp
    initlog(ROOTDEV);
80104b8f:	83 ec 0c             	sub    $0xc,%esp
80104b92:	6a 01                	push   $0x1
80104b94:	e8 a7 e7 ff ff       	call   80103340 <initlog>
80104b99:	83 c4 10             	add    $0x10,%esp
  }

  // Return to "caller", actually trapret (see allocproc).
}
80104b9c:	90                   	nop
80104b9d:	c9                   	leave  
80104b9e:	c3                   	ret    

80104b9f <sleep>:

// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80104b9f:	55                   	push   %ebp
80104ba0:	89 e5                	mov    %esp,%ebp
80104ba2:	83 ec 18             	sub    $0x18,%esp
  struct proc *p = myproc();
80104ba5:	e8 32 f7 ff ff       	call   801042dc <myproc>
80104baa:	89 45 f4             	mov    %eax,-0xc(%ebp)
  
  if(p == 0)
80104bad:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80104bb1:	75 0d                	jne    80104bc0 <sleep+0x21>
    panic("sleep");
80104bb3:	83 ec 0c             	sub    $0xc,%esp
80104bb6:	68 77 88 10 80       	push   $0x80108877
80104bbb:	e8 f5 b9 ff ff       	call   801005b5 <panic>

  if(lk == 0)
80104bc0:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80104bc4:	75 0d                	jne    80104bd3 <sleep+0x34>
    panic("sleep without lk");
80104bc6:	83 ec 0c             	sub    $0xc,%esp
80104bc9:	68 7d 88 10 80       	push   $0x8010887d
80104bce:	e8 e2 b9 ff ff       	call   801005b5 <panic>
  // change p->state and then call sched.
  // Once we hold ptable.lock, we can be
  // guaranteed that we won't miss any wakeup
  // (wakeup runs with ptable.lock locked),
  // so it's okay to release lk.
  if(lk != &ptable.lock){  //DOC: sleeplock0
80104bd3:	81 7d 0c 80 2d 11 80 	cmpl   $0x80112d80,0xc(%ebp)
80104bda:	74 1e                	je     80104bfa <sleep+0x5b>
    acquire(&ptable.lock);  //DOC: sleeplock1
80104bdc:	83 ec 0c             	sub    $0xc,%esp
80104bdf:	68 80 2d 11 80       	push   $0x80112d80
80104be4:	e8 d1 03 00 00       	call   80104fba <acquire>
80104be9:	83 c4 10             	add    $0x10,%esp
    release(lk);
80104bec:	83 ec 0c             	sub    $0xc,%esp
80104bef:	ff 75 0c             	push   0xc(%ebp)
80104bf2:	e8 31 04 00 00       	call   80105028 <release>
80104bf7:	83 c4 10             	add    $0x10,%esp
  }
  // Go to sleep.
  p->chan = chan;
80104bfa:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104bfd:	8b 55 08             	mov    0x8(%ebp),%edx
80104c00:	89 50 20             	mov    %edx,0x20(%eax)
  p->state = SLEEPING;
80104c03:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104c06:	c7 40 0c 02 00 00 00 	movl   $0x2,0xc(%eax)

  sched();
80104c0d:	e8 54 fe ff ff       	call   80104a66 <sched>

  // Tidy up.
  p->chan = 0;
80104c12:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104c15:	c7 40 20 00 00 00 00 	movl   $0x0,0x20(%eax)

  // Reacquire original lock.
  if(lk != &ptable.lock){  //DOC: sleeplock2
80104c1c:	81 7d 0c 80 2d 11 80 	cmpl   $0x80112d80,0xc(%ebp)
80104c23:	74 1e                	je     80104c43 <sleep+0xa4>
    release(&ptable.lock);
80104c25:	83 ec 0c             	sub    $0xc,%esp
80104c28:	68 80 2d 11 80       	push   $0x80112d80
80104c2d:	e8 f6 03 00 00       	call   80105028 <release>
80104c32:	83 c4 10             	add    $0x10,%esp
    acquire(lk);
80104c35:	83 ec 0c             	sub    $0xc,%esp
80104c38:	ff 75 0c             	push   0xc(%ebp)
80104c3b:	e8 7a 03 00 00       	call   80104fba <acquire>
80104c40:	83 c4 10             	add    $0x10,%esp
  }
}
80104c43:	90                   	nop
80104c44:	c9                   	leave  
80104c45:	c3                   	ret    

80104c46 <wakeup1>:
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
80104c46:	55                   	push   %ebp
80104c47:	89 e5                	mov    %esp,%ebp
80104c49:	83 ec 10             	sub    $0x10,%esp
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104c4c:	c7 45 fc b4 2d 11 80 	movl   $0x80112db4,-0x4(%ebp)
80104c53:	eb 24                	jmp    80104c79 <wakeup1+0x33>
    if(p->state == SLEEPING && p->chan == chan)
80104c55:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104c58:	8b 40 0c             	mov    0xc(%eax),%eax
80104c5b:	83 f8 02             	cmp    $0x2,%eax
80104c5e:	75 15                	jne    80104c75 <wakeup1+0x2f>
80104c60:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104c63:	8b 40 20             	mov    0x20(%eax),%eax
80104c66:	39 45 08             	cmp    %eax,0x8(%ebp)
80104c69:	75 0a                	jne    80104c75 <wakeup1+0x2f>
      p->state = RUNNABLE;
80104c6b:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104c6e:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104c75:	83 45 fc 7c          	addl   $0x7c,-0x4(%ebp)
80104c79:	81 7d fc b4 4c 11 80 	cmpl   $0x80114cb4,-0x4(%ebp)
80104c80:	72 d3                	jb     80104c55 <wakeup1+0xf>
}
80104c82:	90                   	nop
80104c83:	90                   	nop
80104c84:	c9                   	leave  
80104c85:	c3                   	ret    

80104c86 <wakeup>:

// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80104c86:	55                   	push   %ebp
80104c87:	89 e5                	mov    %esp,%ebp
80104c89:	83 ec 08             	sub    $0x8,%esp
  acquire(&ptable.lock);
80104c8c:	83 ec 0c             	sub    $0xc,%esp
80104c8f:	68 80 2d 11 80       	push   $0x80112d80
80104c94:	e8 21 03 00 00       	call   80104fba <acquire>
80104c99:	83 c4 10             	add    $0x10,%esp
  wakeup1(chan);
80104c9c:	83 ec 0c             	sub    $0xc,%esp
80104c9f:	ff 75 08             	push   0x8(%ebp)
80104ca2:	e8 9f ff ff ff       	call   80104c46 <wakeup1>
80104ca7:	83 c4 10             	add    $0x10,%esp
  release(&ptable.lock);
80104caa:	83 ec 0c             	sub    $0xc,%esp
80104cad:	68 80 2d 11 80       	push   $0x80112d80
80104cb2:	e8 71 03 00 00       	call   80105028 <release>
80104cb7:	83 c4 10             	add    $0x10,%esp
}
80104cba:	90                   	nop
80104cbb:	c9                   	leave  
80104cbc:	c3                   	ret    

80104cbd <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
80104cbd:	55                   	push   %ebp
80104cbe:	89 e5                	mov    %esp,%ebp
80104cc0:	83 ec 18             	sub    $0x18,%esp
  struct proc *p;

  acquire(&ptable.lock);
80104cc3:	83 ec 0c             	sub    $0xc,%esp
80104cc6:	68 80 2d 11 80       	push   $0x80112d80
80104ccb:	e8 ea 02 00 00       	call   80104fba <acquire>
80104cd0:	83 c4 10             	add    $0x10,%esp
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104cd3:	c7 45 f4 b4 2d 11 80 	movl   $0x80112db4,-0xc(%ebp)
80104cda:	eb 45                	jmp    80104d21 <kill+0x64>
    if(p->pid == pid){
80104cdc:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104cdf:	8b 40 10             	mov    0x10(%eax),%eax
80104ce2:	39 45 08             	cmp    %eax,0x8(%ebp)
80104ce5:	75 36                	jne    80104d1d <kill+0x60>
      p->killed = 1;
80104ce7:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104cea:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
      // Wake process from sleep if necessary.
      if(p->state == SLEEPING)
80104cf1:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104cf4:	8b 40 0c             	mov    0xc(%eax),%eax
80104cf7:	83 f8 02             	cmp    $0x2,%eax
80104cfa:	75 0a                	jne    80104d06 <kill+0x49>
        p->state = RUNNABLE;
80104cfc:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104cff:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
      release(&ptable.lock);
80104d06:	83 ec 0c             	sub    $0xc,%esp
80104d09:	68 80 2d 11 80       	push   $0x80112d80
80104d0e:	e8 15 03 00 00       	call   80105028 <release>
80104d13:	83 c4 10             	add    $0x10,%esp
      return 0;
80104d16:	b8 00 00 00 00       	mov    $0x0,%eax
80104d1b:	eb 22                	jmp    80104d3f <kill+0x82>
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104d1d:	83 45 f4 7c          	addl   $0x7c,-0xc(%ebp)
80104d21:	81 7d f4 b4 4c 11 80 	cmpl   $0x80114cb4,-0xc(%ebp)
80104d28:	72 b2                	jb     80104cdc <kill+0x1f>
    }
  }
  release(&ptable.lock);
80104d2a:	83 ec 0c             	sub    $0xc,%esp
80104d2d:	68 80 2d 11 80       	push   $0x80112d80
80104d32:	e8 f1 02 00 00       	call   80105028 <release>
80104d37:	83 c4 10             	add    $0x10,%esp
  return -1;
80104d3a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80104d3f:	c9                   	leave  
80104d40:	c3                   	ret    

80104d41 <procdump>:
// Print a process listing to console.  For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
80104d41:	55                   	push   %ebp
80104d42:	89 e5                	mov    %esp,%ebp
80104d44:	83 ec 48             	sub    $0x48,%esp
  int i;
  struct proc *p;
  char *state;
  uint pc[10];

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104d47:	c7 45 f0 b4 2d 11 80 	movl   $0x80112db4,-0x10(%ebp)
80104d4e:	e9 d7 00 00 00       	jmp    80104e2a <procdump+0xe9>
    if(p->state == UNUSED)
80104d53:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104d56:	8b 40 0c             	mov    0xc(%eax),%eax
80104d59:	85 c0                	test   %eax,%eax
80104d5b:	0f 84 c4 00 00 00    	je     80104e25 <procdump+0xe4>
      continue;
    if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104d61:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104d64:	8b 40 0c             	mov    0xc(%eax),%eax
80104d67:	83 f8 05             	cmp    $0x5,%eax
80104d6a:	77 23                	ja     80104d8f <procdump+0x4e>
80104d6c:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104d6f:	8b 40 0c             	mov    0xc(%eax),%eax
80104d72:	8b 04 85 08 b0 10 80 	mov    -0x7fef4ff8(,%eax,4),%eax
80104d79:	85 c0                	test   %eax,%eax
80104d7b:	74 12                	je     80104d8f <procdump+0x4e>
      state = states[p->state];
80104d7d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104d80:	8b 40 0c             	mov    0xc(%eax),%eax
80104d83:	8b 04 85 08 b0 10 80 	mov    -0x7fef4ff8(,%eax,4),%eax
80104d8a:	89 45 ec             	mov    %eax,-0x14(%ebp)
80104d8d:	eb 07                	jmp    80104d96 <procdump+0x55>
    else
      state = "???";
80104d8f:	c7 45 ec 8e 88 10 80 	movl   $0x8010888e,-0x14(%ebp)
    cprintf("%d %s %s", p->pid, state, p->name);
80104d96:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104d99:	8d 50 6c             	lea    0x6c(%eax),%edx
80104d9c:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104d9f:	8b 40 10             	mov    0x10(%eax),%eax
80104da2:	52                   	push   %edx
80104da3:	ff 75 ec             	push   -0x14(%ebp)
80104da6:	50                   	push   %eax
80104da7:	68 92 88 10 80       	push   $0x80108892
80104dac:	e8 4f b6 ff ff       	call   80100400 <cprintf>
80104db1:	83 c4 10             	add    $0x10,%esp
    if(p->state == SLEEPING){
80104db4:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104db7:	8b 40 0c             	mov    0xc(%eax),%eax
80104dba:	83 f8 02             	cmp    $0x2,%eax
80104dbd:	75 54                	jne    80104e13 <procdump+0xd2>
      getcallerpcs((uint*)p->context->ebp+2, pc);
80104dbf:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104dc2:	8b 40 1c             	mov    0x1c(%eax),%eax
80104dc5:	8b 40 0c             	mov    0xc(%eax),%eax
80104dc8:	83 c0 08             	add    $0x8,%eax
80104dcb:	89 c2                	mov    %eax,%edx
80104dcd:	83 ec 08             	sub    $0x8,%esp
80104dd0:	8d 45 c4             	lea    -0x3c(%ebp),%eax
80104dd3:	50                   	push   %eax
80104dd4:	52                   	push   %edx
80104dd5:	e8 a0 02 00 00       	call   8010507a <getcallerpcs>
80104dda:	83 c4 10             	add    $0x10,%esp
      for(i=0; i<10 && pc[i] != 0; i++)
80104ddd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104de4:	eb 1c                	jmp    80104e02 <procdump+0xc1>
        cprintf(" %p", pc[i]);
80104de6:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104de9:	8b 44 85 c4          	mov    -0x3c(%ebp,%eax,4),%eax
80104ded:	83 ec 08             	sub    $0x8,%esp
80104df0:	50                   	push   %eax
80104df1:	68 9b 88 10 80       	push   $0x8010889b
80104df6:	e8 05 b6 ff ff       	call   80100400 <cprintf>
80104dfb:	83 c4 10             	add    $0x10,%esp
      for(i=0; i<10 && pc[i] != 0; i++)
80104dfe:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80104e02:	83 7d f4 09          	cmpl   $0x9,-0xc(%ebp)
80104e06:	7f 0b                	jg     80104e13 <procdump+0xd2>
80104e08:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104e0b:	8b 44 85 c4          	mov    -0x3c(%ebp,%eax,4),%eax
80104e0f:	85 c0                	test   %eax,%eax
80104e11:	75 d3                	jne    80104de6 <procdump+0xa5>
    }
    cprintf("\n");
80104e13:	83 ec 0c             	sub    $0xc,%esp
80104e16:	68 9f 88 10 80       	push   $0x8010889f
80104e1b:	e8 e0 b5 ff ff       	call   80100400 <cprintf>
80104e20:	83 c4 10             	add    $0x10,%esp
80104e23:	eb 01                	jmp    80104e26 <procdump+0xe5>
      continue;
80104e25:	90                   	nop
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104e26:	83 45 f0 7c          	addl   $0x7c,-0x10(%ebp)
80104e2a:	81 7d f0 b4 4c 11 80 	cmpl   $0x80114cb4,-0x10(%ebp)
80104e31:	0f 82 1c ff ff ff    	jb     80104d53 <procdump+0x12>
  }
}
80104e37:	90                   	nop
80104e38:	90                   	nop
80104e39:	c9                   	leave  
80104e3a:	c3                   	ret    

80104e3b <initsleeplock>:
#include "spinlock.h"
#include "sleeplock.h"

void
initsleeplock(struct sleeplock *lk, char *name)
{
80104e3b:	55                   	push   %ebp
80104e3c:	89 e5                	mov    %esp,%ebp
80104e3e:	83 ec 08             	sub    $0x8,%esp
  initlock(&lk->lk, "sleep lock");
80104e41:	8b 45 08             	mov    0x8(%ebp),%eax
80104e44:	83 c0 04             	add    $0x4,%eax
80104e47:	83 ec 08             	sub    $0x8,%esp
80104e4a:	68 cb 88 10 80       	push   $0x801088cb
80104e4f:	50                   	push   %eax
80104e50:	e8 43 01 00 00       	call   80104f98 <initlock>
80104e55:	83 c4 10             	add    $0x10,%esp
  lk->name = name;
80104e58:	8b 45 08             	mov    0x8(%ebp),%eax
80104e5b:	8b 55 0c             	mov    0xc(%ebp),%edx
80104e5e:	89 50 38             	mov    %edx,0x38(%eax)
  lk->locked = 0;
80104e61:	8b 45 08             	mov    0x8(%ebp),%eax
80104e64:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  lk->pid = 0;
80104e6a:	8b 45 08             	mov    0x8(%ebp),%eax
80104e6d:	c7 40 3c 00 00 00 00 	movl   $0x0,0x3c(%eax)
}
80104e74:	90                   	nop
80104e75:	c9                   	leave  
80104e76:	c3                   	ret    

80104e77 <acquiresleep>:

void
acquiresleep(struct sleeplock *lk)
{
80104e77:	55                   	push   %ebp
80104e78:	89 e5                	mov    %esp,%ebp
80104e7a:	83 ec 08             	sub    $0x8,%esp
  acquire(&lk->lk);
80104e7d:	8b 45 08             	mov    0x8(%ebp),%eax
80104e80:	83 c0 04             	add    $0x4,%eax
80104e83:	83 ec 0c             	sub    $0xc,%esp
80104e86:	50                   	push   %eax
80104e87:	e8 2e 01 00 00       	call   80104fba <acquire>
80104e8c:	83 c4 10             	add    $0x10,%esp
  while (lk->locked) {
80104e8f:	eb 15                	jmp    80104ea6 <acquiresleep+0x2f>
    sleep(lk, &lk->lk);
80104e91:	8b 45 08             	mov    0x8(%ebp),%eax
80104e94:	83 c0 04             	add    $0x4,%eax
80104e97:	83 ec 08             	sub    $0x8,%esp
80104e9a:	50                   	push   %eax
80104e9b:	ff 75 08             	push   0x8(%ebp)
80104e9e:	e8 fc fc ff ff       	call   80104b9f <sleep>
80104ea3:	83 c4 10             	add    $0x10,%esp
  while (lk->locked) {
80104ea6:	8b 45 08             	mov    0x8(%ebp),%eax
80104ea9:	8b 00                	mov    (%eax),%eax
80104eab:	85 c0                	test   %eax,%eax
80104ead:	75 e2                	jne    80104e91 <acquiresleep+0x1a>
  }
  lk->locked = 1;
80104eaf:	8b 45 08             	mov    0x8(%ebp),%eax
80104eb2:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  lk->pid = myproc()->pid;
80104eb8:	e8 1f f4 ff ff       	call   801042dc <myproc>
80104ebd:	8b 50 10             	mov    0x10(%eax),%edx
80104ec0:	8b 45 08             	mov    0x8(%ebp),%eax
80104ec3:	89 50 3c             	mov    %edx,0x3c(%eax)
  release(&lk->lk);
80104ec6:	8b 45 08             	mov    0x8(%ebp),%eax
80104ec9:	83 c0 04             	add    $0x4,%eax
80104ecc:	83 ec 0c             	sub    $0xc,%esp
80104ecf:	50                   	push   %eax
80104ed0:	e8 53 01 00 00       	call   80105028 <release>
80104ed5:	83 c4 10             	add    $0x10,%esp
}
80104ed8:	90                   	nop
80104ed9:	c9                   	leave  
80104eda:	c3                   	ret    

80104edb <releasesleep>:

void
releasesleep(struct sleeplock *lk)
{
80104edb:	55                   	push   %ebp
80104edc:	89 e5                	mov    %esp,%ebp
80104ede:	83 ec 08             	sub    $0x8,%esp
  acquire(&lk->lk);
80104ee1:	8b 45 08             	mov    0x8(%ebp),%eax
80104ee4:	83 c0 04             	add    $0x4,%eax
80104ee7:	83 ec 0c             	sub    $0xc,%esp
80104eea:	50                   	push   %eax
80104eeb:	e8 ca 00 00 00       	call   80104fba <acquire>
80104ef0:	83 c4 10             	add    $0x10,%esp
  lk->locked = 0;
80104ef3:	8b 45 08             	mov    0x8(%ebp),%eax
80104ef6:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  lk->pid = 0;
80104efc:	8b 45 08             	mov    0x8(%ebp),%eax
80104eff:	c7 40 3c 00 00 00 00 	movl   $0x0,0x3c(%eax)
  wakeup(lk);
80104f06:	83 ec 0c             	sub    $0xc,%esp
80104f09:	ff 75 08             	push   0x8(%ebp)
80104f0c:	e8 75 fd ff ff       	call   80104c86 <wakeup>
80104f11:	83 c4 10             	add    $0x10,%esp
  release(&lk->lk);
80104f14:	8b 45 08             	mov    0x8(%ebp),%eax
80104f17:	83 c0 04             	add    $0x4,%eax
80104f1a:	83 ec 0c             	sub    $0xc,%esp
80104f1d:	50                   	push   %eax
80104f1e:	e8 05 01 00 00       	call   80105028 <release>
80104f23:	83 c4 10             	add    $0x10,%esp
}
80104f26:	90                   	nop
80104f27:	c9                   	leave  
80104f28:	c3                   	ret    

80104f29 <holdingsleep>:

int
holdingsleep(struct sleeplock *lk)
{
80104f29:	55                   	push   %ebp
80104f2a:	89 e5                	mov    %esp,%ebp
80104f2c:	83 ec 18             	sub    $0x18,%esp
  int r;
  
  acquire(&lk->lk);
80104f2f:	8b 45 08             	mov    0x8(%ebp),%eax
80104f32:	83 c0 04             	add    $0x4,%eax
80104f35:	83 ec 0c             	sub    $0xc,%esp
80104f38:	50                   	push   %eax
80104f39:	e8 7c 00 00 00       	call   80104fba <acquire>
80104f3e:	83 c4 10             	add    $0x10,%esp
  r = lk->locked;
80104f41:	8b 45 08             	mov    0x8(%ebp),%eax
80104f44:	8b 00                	mov    (%eax),%eax
80104f46:	89 45 f4             	mov    %eax,-0xc(%ebp)
  release(&lk->lk);
80104f49:	8b 45 08             	mov    0x8(%ebp),%eax
80104f4c:	83 c0 04             	add    $0x4,%eax
80104f4f:	83 ec 0c             	sub    $0xc,%esp
80104f52:	50                   	push   %eax
80104f53:	e8 d0 00 00 00       	call   80105028 <release>
80104f58:	83 c4 10             	add    $0x10,%esp
  return r;
80104f5b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80104f5e:	c9                   	leave  
80104f5f:	c3                   	ret    

80104f60 <readeflags>:
{
80104f60:	55                   	push   %ebp
80104f61:	89 e5                	mov    %esp,%ebp
80104f63:	83 ec 10             	sub    $0x10,%esp
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80104f66:	9c                   	pushf  
80104f67:	58                   	pop    %eax
80104f68:	89 45 fc             	mov    %eax,-0x4(%ebp)
  return eflags;
80104f6b:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80104f6e:	c9                   	leave  
80104f6f:	c3                   	ret    

80104f70 <cli>:
{
80104f70:	55                   	push   %ebp
80104f71:	89 e5                	mov    %esp,%ebp
  asm volatile("cli");
80104f73:	fa                   	cli    
}
80104f74:	90                   	nop
80104f75:	5d                   	pop    %ebp
80104f76:	c3                   	ret    

80104f77 <sti>:
{
80104f77:	55                   	push   %ebp
80104f78:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
80104f7a:	fb                   	sti    
}
80104f7b:	90                   	nop
80104f7c:	5d                   	pop    %ebp
80104f7d:	c3                   	ret    

80104f7e <xchg>:
{
80104f7e:	55                   	push   %ebp
80104f7f:	89 e5                	mov    %esp,%ebp
80104f81:	83 ec 10             	sub    $0x10,%esp
  asm volatile("lock; xchgl %0, %1" :
80104f84:	8b 55 08             	mov    0x8(%ebp),%edx
80104f87:	8b 45 0c             	mov    0xc(%ebp),%eax
80104f8a:	8b 4d 08             	mov    0x8(%ebp),%ecx
80104f8d:	f0 87 02             	lock xchg %eax,(%edx)
80104f90:	89 45 fc             	mov    %eax,-0x4(%ebp)
  return result;
80104f93:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80104f96:	c9                   	leave  
80104f97:	c3                   	ret    

80104f98 <initlock>:
#include "proc.h"
#include "spinlock.h"

void
initlock(struct spinlock *lk, char *name)
{
80104f98:	55                   	push   %ebp
80104f99:	89 e5                	mov    %esp,%ebp
  lk->name = name;
80104f9b:	8b 45 08             	mov    0x8(%ebp),%eax
80104f9e:	8b 55 0c             	mov    0xc(%ebp),%edx
80104fa1:	89 50 04             	mov    %edx,0x4(%eax)
  lk->locked = 0;
80104fa4:	8b 45 08             	mov    0x8(%ebp),%eax
80104fa7:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  lk->cpu = 0;
80104fad:	8b 45 08             	mov    0x8(%ebp),%eax
80104fb0:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
}
80104fb7:	90                   	nop
80104fb8:	5d                   	pop    %ebp
80104fb9:	c3                   	ret    

80104fba <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
80104fba:	55                   	push   %ebp
80104fbb:	89 e5                	mov    %esp,%ebp
80104fbd:	53                   	push   %ebx
80104fbe:	83 ec 04             	sub    $0x4,%esp
  pushcli(); // disable interrupts to avoid deadlock.
80104fc1:	e8 5f 01 00 00       	call   80105125 <pushcli>
  if(holding(lk))
80104fc6:	8b 45 08             	mov    0x8(%ebp),%eax
80104fc9:	83 ec 0c             	sub    $0xc,%esp
80104fcc:	50                   	push   %eax
80104fcd:	e8 23 01 00 00       	call   801050f5 <holding>
80104fd2:	83 c4 10             	add    $0x10,%esp
80104fd5:	85 c0                	test   %eax,%eax
80104fd7:	74 0d                	je     80104fe6 <acquire+0x2c>
    panic("acquire");
80104fd9:	83 ec 0c             	sub    $0xc,%esp
80104fdc:	68 d6 88 10 80       	push   $0x801088d6
80104fe1:	e8 cf b5 ff ff       	call   801005b5 <panic>

  // The xchg is atomic.
  while(xchg(&lk->locked, 1) != 0)
80104fe6:	90                   	nop
80104fe7:	8b 45 08             	mov    0x8(%ebp),%eax
80104fea:	83 ec 08             	sub    $0x8,%esp
80104fed:	6a 01                	push   $0x1
80104fef:	50                   	push   %eax
80104ff0:	e8 89 ff ff ff       	call   80104f7e <xchg>
80104ff5:	83 c4 10             	add    $0x10,%esp
80104ff8:	85 c0                	test   %eax,%eax
80104ffa:	75 eb                	jne    80104fe7 <acquire+0x2d>
    ;

  // Tell the C compiler and the processor to not move loads or stores
  // past this point, to ensure that the critical section's memory
  // references happen after the lock is acquired.
  __sync_synchronize();
80104ffc:	f0 83 0c 24 00       	lock orl $0x0,(%esp)

  // Record info about lock acquisition for debugging.
  lk->cpu = mycpu();
80105001:	8b 5d 08             	mov    0x8(%ebp),%ebx
80105004:	e8 5b f2 ff ff       	call   80104264 <mycpu>
80105009:	89 43 08             	mov    %eax,0x8(%ebx)
  getcallerpcs(&lk, lk->pcs);
8010500c:	8b 45 08             	mov    0x8(%ebp),%eax
8010500f:	83 c0 0c             	add    $0xc,%eax
80105012:	83 ec 08             	sub    $0x8,%esp
80105015:	50                   	push   %eax
80105016:	8d 45 08             	lea    0x8(%ebp),%eax
80105019:	50                   	push   %eax
8010501a:	e8 5b 00 00 00       	call   8010507a <getcallerpcs>
8010501f:	83 c4 10             	add    $0x10,%esp
}
80105022:	90                   	nop
80105023:	8b 5d fc             	mov    -0x4(%ebp),%ebx
80105026:	c9                   	leave  
80105027:	c3                   	ret    

80105028 <release>:

// Release the lock.
void
release(struct spinlock *lk)
{
80105028:	55                   	push   %ebp
80105029:	89 e5                	mov    %esp,%ebp
8010502b:	83 ec 08             	sub    $0x8,%esp
  if(!holding(lk))
8010502e:	83 ec 0c             	sub    $0xc,%esp
80105031:	ff 75 08             	push   0x8(%ebp)
80105034:	e8 bc 00 00 00       	call   801050f5 <holding>
80105039:	83 c4 10             	add    $0x10,%esp
8010503c:	85 c0                	test   %eax,%eax
8010503e:	75 0d                	jne    8010504d <release+0x25>
    panic("release");
80105040:	83 ec 0c             	sub    $0xc,%esp
80105043:	68 de 88 10 80       	push   $0x801088de
80105048:	e8 68 b5 ff ff       	call   801005b5 <panic>

  lk->pcs[0] = 0;
8010504d:	8b 45 08             	mov    0x8(%ebp),%eax
80105050:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
  lk->cpu = 0;
80105057:	8b 45 08             	mov    0x8(%ebp),%eax
8010505a:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
  // Tell the C compiler and the processor to not move loads or stores
  // past this point, to ensure that all the stores in the critical
  // section are visible to other cores before the lock is released.
  // Both the C compiler and the hardware may re-order loads and
  // stores; __sync_synchronize() tells them both not to.
  __sync_synchronize();
80105061:	f0 83 0c 24 00       	lock orl $0x0,(%esp)

  // Release the lock, equivalent to lk->locked = 0.
  // This code can't use a C assignment, since it might
  // not be atomic. A real OS would use C atomics here.
  asm volatile("movl $0, %0" : "+m" (lk->locked) : );
80105066:	8b 45 08             	mov    0x8(%ebp),%eax
80105069:	8b 55 08             	mov    0x8(%ebp),%edx
8010506c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

  popcli();
80105072:	e8 fb 00 00 00       	call   80105172 <popcli>
}
80105077:	90                   	nop
80105078:	c9                   	leave  
80105079:	c3                   	ret    

8010507a <getcallerpcs>:

// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
8010507a:	55                   	push   %ebp
8010507b:	89 e5                	mov    %esp,%ebp
8010507d:	83 ec 10             	sub    $0x10,%esp
  uint *ebp;
  int i;

  ebp = (uint*)v - 2;
80105080:	8b 45 08             	mov    0x8(%ebp),%eax
80105083:	83 e8 08             	sub    $0x8,%eax
80105086:	89 45 fc             	mov    %eax,-0x4(%ebp)
  for(i = 0; i < 10; i++){
80105089:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
80105090:	eb 38                	jmp    801050ca <getcallerpcs+0x50>
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80105092:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
80105096:	74 53                	je     801050eb <getcallerpcs+0x71>
80105098:	81 7d fc ff ff ff 7f 	cmpl   $0x7fffffff,-0x4(%ebp)
8010509f:	76 4a                	jbe    801050eb <getcallerpcs+0x71>
801050a1:	83 7d fc ff          	cmpl   $0xffffffff,-0x4(%ebp)
801050a5:	74 44                	je     801050eb <getcallerpcs+0x71>
      break;
    pcs[i] = ebp[1];     // saved %eip
801050a7:	8b 45 f8             	mov    -0x8(%ebp),%eax
801050aa:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
801050b1:	8b 45 0c             	mov    0xc(%ebp),%eax
801050b4:	01 c2                	add    %eax,%edx
801050b6:	8b 45 fc             	mov    -0x4(%ebp),%eax
801050b9:	8b 40 04             	mov    0x4(%eax),%eax
801050bc:	89 02                	mov    %eax,(%edx)
    ebp = (uint*)ebp[0]; // saved %ebp
801050be:	8b 45 fc             	mov    -0x4(%ebp),%eax
801050c1:	8b 00                	mov    (%eax),%eax
801050c3:	89 45 fc             	mov    %eax,-0x4(%ebp)
  for(i = 0; i < 10; i++){
801050c6:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
801050ca:	83 7d f8 09          	cmpl   $0x9,-0x8(%ebp)
801050ce:	7e c2                	jle    80105092 <getcallerpcs+0x18>
  }
  for(; i < 10; i++)
801050d0:	eb 19                	jmp    801050eb <getcallerpcs+0x71>
    pcs[i] = 0;
801050d2:	8b 45 f8             	mov    -0x8(%ebp),%eax
801050d5:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
801050dc:	8b 45 0c             	mov    0xc(%ebp),%eax
801050df:	01 d0                	add    %edx,%eax
801050e1:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  for(; i < 10; i++)
801050e7:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
801050eb:	83 7d f8 09          	cmpl   $0x9,-0x8(%ebp)
801050ef:	7e e1                	jle    801050d2 <getcallerpcs+0x58>
}
801050f1:	90                   	nop
801050f2:	90                   	nop
801050f3:	c9                   	leave  
801050f4:	c3                   	ret    

801050f5 <holding>:

// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
801050f5:	55                   	push   %ebp
801050f6:	89 e5                	mov    %esp,%ebp
801050f8:	53                   	push   %ebx
801050f9:	83 ec 04             	sub    $0x4,%esp
  return lock->locked && lock->cpu == mycpu();
801050fc:	8b 45 08             	mov    0x8(%ebp),%eax
801050ff:	8b 00                	mov    (%eax),%eax
80105101:	85 c0                	test   %eax,%eax
80105103:	74 16                	je     8010511b <holding+0x26>
80105105:	8b 45 08             	mov    0x8(%ebp),%eax
80105108:	8b 58 08             	mov    0x8(%eax),%ebx
8010510b:	e8 54 f1 ff ff       	call   80104264 <mycpu>
80105110:	39 c3                	cmp    %eax,%ebx
80105112:	75 07                	jne    8010511b <holding+0x26>
80105114:	b8 01 00 00 00       	mov    $0x1,%eax
80105119:	eb 05                	jmp    80105120 <holding+0x2b>
8010511b:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105120:	8b 5d fc             	mov    -0x4(%ebp),%ebx
80105123:	c9                   	leave  
80105124:	c3                   	ret    

80105125 <pushcli>:
// it takes two popcli to undo two pushcli.  Also, if interrupts
// are off, then pushcli, popcli leaves them off.

void
pushcli(void)
{
80105125:	55                   	push   %ebp
80105126:	89 e5                	mov    %esp,%ebp
80105128:	83 ec 18             	sub    $0x18,%esp
  int eflags;

  eflags = readeflags();
8010512b:	e8 30 fe ff ff       	call   80104f60 <readeflags>
80105130:	89 45 f4             	mov    %eax,-0xc(%ebp)
  cli();
80105133:	e8 38 fe ff ff       	call   80104f70 <cli>
  if(mycpu()->ncli == 0)
80105138:	e8 27 f1 ff ff       	call   80104264 <mycpu>
8010513d:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
80105143:	85 c0                	test   %eax,%eax
80105145:	75 14                	jne    8010515b <pushcli+0x36>
    mycpu()->intena = eflags & FL_IF;
80105147:	e8 18 f1 ff ff       	call   80104264 <mycpu>
8010514c:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010514f:	81 e2 00 02 00 00    	and    $0x200,%edx
80105155:	89 90 a8 00 00 00    	mov    %edx,0xa8(%eax)
  mycpu()->ncli += 1;
8010515b:	e8 04 f1 ff ff       	call   80104264 <mycpu>
80105160:	8b 90 a4 00 00 00    	mov    0xa4(%eax),%edx
80105166:	83 c2 01             	add    $0x1,%edx
80105169:	89 90 a4 00 00 00    	mov    %edx,0xa4(%eax)
}
8010516f:	90                   	nop
80105170:	c9                   	leave  
80105171:	c3                   	ret    

80105172 <popcli>:

void
popcli(void)
{
80105172:	55                   	push   %ebp
80105173:	89 e5                	mov    %esp,%ebp
80105175:	83 ec 08             	sub    $0x8,%esp
  if(readeflags()&FL_IF)
80105178:	e8 e3 fd ff ff       	call   80104f60 <readeflags>
8010517d:	25 00 02 00 00       	and    $0x200,%eax
80105182:	85 c0                	test   %eax,%eax
80105184:	74 0d                	je     80105193 <popcli+0x21>
    panic("popcli - interruptible");
80105186:	83 ec 0c             	sub    $0xc,%esp
80105189:	68 e6 88 10 80       	push   $0x801088e6
8010518e:	e8 22 b4 ff ff       	call   801005b5 <panic>
  if(--mycpu()->ncli < 0)
80105193:	e8 cc f0 ff ff       	call   80104264 <mycpu>
80105198:	8b 90 a4 00 00 00    	mov    0xa4(%eax),%edx
8010519e:	83 ea 01             	sub    $0x1,%edx
801051a1:	89 90 a4 00 00 00    	mov    %edx,0xa4(%eax)
801051a7:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
801051ad:	85 c0                	test   %eax,%eax
801051af:	79 0d                	jns    801051be <popcli+0x4c>
    panic("popcli");
801051b1:	83 ec 0c             	sub    $0xc,%esp
801051b4:	68 fd 88 10 80       	push   $0x801088fd
801051b9:	e8 f7 b3 ff ff       	call   801005b5 <panic>
  if(mycpu()->ncli == 0 && mycpu()->intena)
801051be:	e8 a1 f0 ff ff       	call   80104264 <mycpu>
801051c3:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
801051c9:	85 c0                	test   %eax,%eax
801051cb:	75 14                	jne    801051e1 <popcli+0x6f>
801051cd:	e8 92 f0 ff ff       	call   80104264 <mycpu>
801051d2:	8b 80 a8 00 00 00    	mov    0xa8(%eax),%eax
801051d8:	85 c0                	test   %eax,%eax
801051da:	74 05                	je     801051e1 <popcli+0x6f>
    sti();
801051dc:	e8 96 fd ff ff       	call   80104f77 <sti>
}
801051e1:	90                   	nop
801051e2:	c9                   	leave  
801051e3:	c3                   	ret    

801051e4 <stosb>:
{
801051e4:	55                   	push   %ebp
801051e5:	89 e5                	mov    %esp,%ebp
801051e7:	57                   	push   %edi
801051e8:	53                   	push   %ebx
  asm volatile("cld; rep stosb" :
801051e9:	8b 4d 08             	mov    0x8(%ebp),%ecx
801051ec:	8b 55 10             	mov    0x10(%ebp),%edx
801051ef:	8b 45 0c             	mov    0xc(%ebp),%eax
801051f2:	89 cb                	mov    %ecx,%ebx
801051f4:	89 df                	mov    %ebx,%edi
801051f6:	89 d1                	mov    %edx,%ecx
801051f8:	fc                   	cld    
801051f9:	f3 aa                	rep stos %al,%es:(%edi)
801051fb:	89 ca                	mov    %ecx,%edx
801051fd:	89 fb                	mov    %edi,%ebx
801051ff:	89 5d 08             	mov    %ebx,0x8(%ebp)
80105202:	89 55 10             	mov    %edx,0x10(%ebp)
}
80105205:	90                   	nop
80105206:	5b                   	pop    %ebx
80105207:	5f                   	pop    %edi
80105208:	5d                   	pop    %ebp
80105209:	c3                   	ret    

8010520a <stosl>:
{
8010520a:	55                   	push   %ebp
8010520b:	89 e5                	mov    %esp,%ebp
8010520d:	57                   	push   %edi
8010520e:	53                   	push   %ebx
  asm volatile("cld; rep stosl" :
8010520f:	8b 4d 08             	mov    0x8(%ebp),%ecx
80105212:	8b 55 10             	mov    0x10(%ebp),%edx
80105215:	8b 45 0c             	mov    0xc(%ebp),%eax
80105218:	89 cb                	mov    %ecx,%ebx
8010521a:	89 df                	mov    %ebx,%edi
8010521c:	89 d1                	mov    %edx,%ecx
8010521e:	fc                   	cld    
8010521f:	f3 ab                	rep stos %eax,%es:(%edi)
80105221:	89 ca                	mov    %ecx,%edx
80105223:	89 fb                	mov    %edi,%ebx
80105225:	89 5d 08             	mov    %ebx,0x8(%ebp)
80105228:	89 55 10             	mov    %edx,0x10(%ebp)
}
8010522b:	90                   	nop
8010522c:	5b                   	pop    %ebx
8010522d:	5f                   	pop    %edi
8010522e:	5d                   	pop    %ebp
8010522f:	c3                   	ret    

80105230 <memset>:
#include "types.h"
#include "x86.h"

void*
memset(void *dst, int c, uint n)
{
80105230:	55                   	push   %ebp
80105231:	89 e5                	mov    %esp,%ebp
  if ((int)dst%4 == 0 && n%4 == 0){
80105233:	8b 45 08             	mov    0x8(%ebp),%eax
80105236:	83 e0 03             	and    $0x3,%eax
80105239:	85 c0                	test   %eax,%eax
8010523b:	75 43                	jne    80105280 <memset+0x50>
8010523d:	8b 45 10             	mov    0x10(%ebp),%eax
80105240:	83 e0 03             	and    $0x3,%eax
80105243:	85 c0                	test   %eax,%eax
80105245:	75 39                	jne    80105280 <memset+0x50>
    c &= 0xFF;
80105247:	81 65 0c ff 00 00 00 	andl   $0xff,0xc(%ebp)
    stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
8010524e:	8b 45 10             	mov    0x10(%ebp),%eax
80105251:	c1 e8 02             	shr    $0x2,%eax
80105254:	89 c2                	mov    %eax,%edx
80105256:	8b 45 0c             	mov    0xc(%ebp),%eax
80105259:	c1 e0 18             	shl    $0x18,%eax
8010525c:	89 c1                	mov    %eax,%ecx
8010525e:	8b 45 0c             	mov    0xc(%ebp),%eax
80105261:	c1 e0 10             	shl    $0x10,%eax
80105264:	09 c1                	or     %eax,%ecx
80105266:	8b 45 0c             	mov    0xc(%ebp),%eax
80105269:	c1 e0 08             	shl    $0x8,%eax
8010526c:	09 c8                	or     %ecx,%eax
8010526e:	0b 45 0c             	or     0xc(%ebp),%eax
80105271:	52                   	push   %edx
80105272:	50                   	push   %eax
80105273:	ff 75 08             	push   0x8(%ebp)
80105276:	e8 8f ff ff ff       	call   8010520a <stosl>
8010527b:	83 c4 0c             	add    $0xc,%esp
8010527e:	eb 12                	jmp    80105292 <memset+0x62>
  } else
    stosb(dst, c, n);
80105280:	8b 45 10             	mov    0x10(%ebp),%eax
80105283:	50                   	push   %eax
80105284:	ff 75 0c             	push   0xc(%ebp)
80105287:	ff 75 08             	push   0x8(%ebp)
8010528a:	e8 55 ff ff ff       	call   801051e4 <stosb>
8010528f:	83 c4 0c             	add    $0xc,%esp
  return dst;
80105292:	8b 45 08             	mov    0x8(%ebp),%eax
}
80105295:	c9                   	leave  
80105296:	c3                   	ret    

80105297 <memcmp>:

int
memcmp(const void *v1, const void *v2, uint n)
{
80105297:	55                   	push   %ebp
80105298:	89 e5                	mov    %esp,%ebp
8010529a:	83 ec 10             	sub    $0x10,%esp
  const uchar *s1, *s2;

  s1 = v1;
8010529d:	8b 45 08             	mov    0x8(%ebp),%eax
801052a0:	89 45 fc             	mov    %eax,-0x4(%ebp)
  s2 = v2;
801052a3:	8b 45 0c             	mov    0xc(%ebp),%eax
801052a6:	89 45 f8             	mov    %eax,-0x8(%ebp)
  while(n-- > 0){
801052a9:	eb 30                	jmp    801052db <memcmp+0x44>
    if(*s1 != *s2)
801052ab:	8b 45 fc             	mov    -0x4(%ebp),%eax
801052ae:	0f b6 10             	movzbl (%eax),%edx
801052b1:	8b 45 f8             	mov    -0x8(%ebp),%eax
801052b4:	0f b6 00             	movzbl (%eax),%eax
801052b7:	38 c2                	cmp    %al,%dl
801052b9:	74 18                	je     801052d3 <memcmp+0x3c>
      return *s1 - *s2;
801052bb:	8b 45 fc             	mov    -0x4(%ebp),%eax
801052be:	0f b6 00             	movzbl (%eax),%eax
801052c1:	0f b6 d0             	movzbl %al,%edx
801052c4:	8b 45 f8             	mov    -0x8(%ebp),%eax
801052c7:	0f b6 00             	movzbl (%eax),%eax
801052ca:	0f b6 c8             	movzbl %al,%ecx
801052cd:	89 d0                	mov    %edx,%eax
801052cf:	29 c8                	sub    %ecx,%eax
801052d1:	eb 1a                	jmp    801052ed <memcmp+0x56>
    s1++, s2++;
801052d3:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
801052d7:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
  while(n-- > 0){
801052db:	8b 45 10             	mov    0x10(%ebp),%eax
801052de:	8d 50 ff             	lea    -0x1(%eax),%edx
801052e1:	89 55 10             	mov    %edx,0x10(%ebp)
801052e4:	85 c0                	test   %eax,%eax
801052e6:	75 c3                	jne    801052ab <memcmp+0x14>
  }

  return 0;
801052e8:	b8 00 00 00 00       	mov    $0x0,%eax
}
801052ed:	c9                   	leave  
801052ee:	c3                   	ret    

801052ef <memmove>:

void*
memmove(void *dst, const void *src, uint n)
{
801052ef:	55                   	push   %ebp
801052f0:	89 e5                	mov    %esp,%ebp
801052f2:	83 ec 10             	sub    $0x10,%esp
  const char *s;
  char *d;

  s = src;
801052f5:	8b 45 0c             	mov    0xc(%ebp),%eax
801052f8:	89 45 fc             	mov    %eax,-0x4(%ebp)
  d = dst;
801052fb:	8b 45 08             	mov    0x8(%ebp),%eax
801052fe:	89 45 f8             	mov    %eax,-0x8(%ebp)
  if(s < d && s + n > d){
80105301:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105304:	3b 45 f8             	cmp    -0x8(%ebp),%eax
80105307:	73 54                	jae    8010535d <memmove+0x6e>
80105309:	8b 55 fc             	mov    -0x4(%ebp),%edx
8010530c:	8b 45 10             	mov    0x10(%ebp),%eax
8010530f:	01 d0                	add    %edx,%eax
80105311:	39 45 f8             	cmp    %eax,-0x8(%ebp)
80105314:	73 47                	jae    8010535d <memmove+0x6e>
    s += n;
80105316:	8b 45 10             	mov    0x10(%ebp),%eax
80105319:	01 45 fc             	add    %eax,-0x4(%ebp)
    d += n;
8010531c:	8b 45 10             	mov    0x10(%ebp),%eax
8010531f:	01 45 f8             	add    %eax,-0x8(%ebp)
    while(n-- > 0)
80105322:	eb 13                	jmp    80105337 <memmove+0x48>
      *--d = *--s;
80105324:	83 6d fc 01          	subl   $0x1,-0x4(%ebp)
80105328:	83 6d f8 01          	subl   $0x1,-0x8(%ebp)
8010532c:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010532f:	0f b6 10             	movzbl (%eax),%edx
80105332:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105335:	88 10                	mov    %dl,(%eax)
    while(n-- > 0)
80105337:	8b 45 10             	mov    0x10(%ebp),%eax
8010533a:	8d 50 ff             	lea    -0x1(%eax),%edx
8010533d:	89 55 10             	mov    %edx,0x10(%ebp)
80105340:	85 c0                	test   %eax,%eax
80105342:	75 e0                	jne    80105324 <memmove+0x35>
  if(s < d && s + n > d){
80105344:	eb 24                	jmp    8010536a <memmove+0x7b>
  } else
    while(n-- > 0)
      *d++ = *s++;
80105346:	8b 55 fc             	mov    -0x4(%ebp),%edx
80105349:	8d 42 01             	lea    0x1(%edx),%eax
8010534c:	89 45 fc             	mov    %eax,-0x4(%ebp)
8010534f:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105352:	8d 48 01             	lea    0x1(%eax),%ecx
80105355:	89 4d f8             	mov    %ecx,-0x8(%ebp)
80105358:	0f b6 12             	movzbl (%edx),%edx
8010535b:	88 10                	mov    %dl,(%eax)
    while(n-- > 0)
8010535d:	8b 45 10             	mov    0x10(%ebp),%eax
80105360:	8d 50 ff             	lea    -0x1(%eax),%edx
80105363:	89 55 10             	mov    %edx,0x10(%ebp)
80105366:	85 c0                	test   %eax,%eax
80105368:	75 dc                	jne    80105346 <memmove+0x57>

  return dst;
8010536a:	8b 45 08             	mov    0x8(%ebp),%eax
}
8010536d:	c9                   	leave  
8010536e:	c3                   	ret    

8010536f <memcpy>:

// memcpy exists to placate GCC.  Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
8010536f:	55                   	push   %ebp
80105370:	89 e5                	mov    %esp,%ebp
  return memmove(dst, src, n);
80105372:	ff 75 10             	push   0x10(%ebp)
80105375:	ff 75 0c             	push   0xc(%ebp)
80105378:	ff 75 08             	push   0x8(%ebp)
8010537b:	e8 6f ff ff ff       	call   801052ef <memmove>
80105380:	83 c4 0c             	add    $0xc,%esp
}
80105383:	c9                   	leave  
80105384:	c3                   	ret    

80105385 <strncmp>:

int
strncmp(const char *p, const char *q, uint n)
{
80105385:	55                   	push   %ebp
80105386:	89 e5                	mov    %esp,%ebp
  while(n > 0 && *p && *p == *q)
80105388:	eb 0c                	jmp    80105396 <strncmp+0x11>
    n--, p++, q++;
8010538a:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
8010538e:	83 45 08 01          	addl   $0x1,0x8(%ebp)
80105392:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
  while(n > 0 && *p && *p == *q)
80105396:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
8010539a:	74 1a                	je     801053b6 <strncmp+0x31>
8010539c:	8b 45 08             	mov    0x8(%ebp),%eax
8010539f:	0f b6 00             	movzbl (%eax),%eax
801053a2:	84 c0                	test   %al,%al
801053a4:	74 10                	je     801053b6 <strncmp+0x31>
801053a6:	8b 45 08             	mov    0x8(%ebp),%eax
801053a9:	0f b6 10             	movzbl (%eax),%edx
801053ac:	8b 45 0c             	mov    0xc(%ebp),%eax
801053af:	0f b6 00             	movzbl (%eax),%eax
801053b2:	38 c2                	cmp    %al,%dl
801053b4:	74 d4                	je     8010538a <strncmp+0x5>
  if(n == 0)
801053b6:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801053ba:	75 07                	jne    801053c3 <strncmp+0x3e>
    return 0;
801053bc:	b8 00 00 00 00       	mov    $0x0,%eax
801053c1:	eb 16                	jmp    801053d9 <strncmp+0x54>
  return (uchar)*p - (uchar)*q;
801053c3:	8b 45 08             	mov    0x8(%ebp),%eax
801053c6:	0f b6 00             	movzbl (%eax),%eax
801053c9:	0f b6 d0             	movzbl %al,%edx
801053cc:	8b 45 0c             	mov    0xc(%ebp),%eax
801053cf:	0f b6 00             	movzbl (%eax),%eax
801053d2:	0f b6 c8             	movzbl %al,%ecx
801053d5:	89 d0                	mov    %edx,%eax
801053d7:	29 c8                	sub    %ecx,%eax
}
801053d9:	5d                   	pop    %ebp
801053da:	c3                   	ret    

801053db <strncpy>:

char*
strncpy(char *s, const char *t, int n)
{
801053db:	55                   	push   %ebp
801053dc:	89 e5                	mov    %esp,%ebp
801053de:	83 ec 10             	sub    $0x10,%esp
  char *os;

  os = s;
801053e1:	8b 45 08             	mov    0x8(%ebp),%eax
801053e4:	89 45 fc             	mov    %eax,-0x4(%ebp)
  while(n-- > 0 && (*s++ = *t++) != 0)
801053e7:	90                   	nop
801053e8:	8b 45 10             	mov    0x10(%ebp),%eax
801053eb:	8d 50 ff             	lea    -0x1(%eax),%edx
801053ee:	89 55 10             	mov    %edx,0x10(%ebp)
801053f1:	85 c0                	test   %eax,%eax
801053f3:	7e 2c                	jle    80105421 <strncpy+0x46>
801053f5:	8b 55 0c             	mov    0xc(%ebp),%edx
801053f8:	8d 42 01             	lea    0x1(%edx),%eax
801053fb:	89 45 0c             	mov    %eax,0xc(%ebp)
801053fe:	8b 45 08             	mov    0x8(%ebp),%eax
80105401:	8d 48 01             	lea    0x1(%eax),%ecx
80105404:	89 4d 08             	mov    %ecx,0x8(%ebp)
80105407:	0f b6 12             	movzbl (%edx),%edx
8010540a:	88 10                	mov    %dl,(%eax)
8010540c:	0f b6 00             	movzbl (%eax),%eax
8010540f:	84 c0                	test   %al,%al
80105411:	75 d5                	jne    801053e8 <strncpy+0xd>
    ;
  while(n-- > 0)
80105413:	eb 0c                	jmp    80105421 <strncpy+0x46>
    *s++ = 0;
80105415:	8b 45 08             	mov    0x8(%ebp),%eax
80105418:	8d 50 01             	lea    0x1(%eax),%edx
8010541b:	89 55 08             	mov    %edx,0x8(%ebp)
8010541e:	c6 00 00             	movb   $0x0,(%eax)
  while(n-- > 0)
80105421:	8b 45 10             	mov    0x10(%ebp),%eax
80105424:	8d 50 ff             	lea    -0x1(%eax),%edx
80105427:	89 55 10             	mov    %edx,0x10(%ebp)
8010542a:	85 c0                	test   %eax,%eax
8010542c:	7f e7                	jg     80105415 <strncpy+0x3a>
  return os;
8010542e:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80105431:	c9                   	leave  
80105432:	c3                   	ret    

80105433 <safestrcpy>:

// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
80105433:	55                   	push   %ebp
80105434:	89 e5                	mov    %esp,%ebp
80105436:	83 ec 10             	sub    $0x10,%esp
  char *os;

  os = s;
80105439:	8b 45 08             	mov    0x8(%ebp),%eax
8010543c:	89 45 fc             	mov    %eax,-0x4(%ebp)
  if(n <= 0)
8010543f:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105443:	7f 05                	jg     8010544a <safestrcpy+0x17>
    return os;
80105445:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105448:	eb 32                	jmp    8010547c <safestrcpy+0x49>
  while(--n > 0 && (*s++ = *t++) != 0)
8010544a:	90                   	nop
8010544b:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
8010544f:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105453:	7e 1e                	jle    80105473 <safestrcpy+0x40>
80105455:	8b 55 0c             	mov    0xc(%ebp),%edx
80105458:	8d 42 01             	lea    0x1(%edx),%eax
8010545b:	89 45 0c             	mov    %eax,0xc(%ebp)
8010545e:	8b 45 08             	mov    0x8(%ebp),%eax
80105461:	8d 48 01             	lea    0x1(%eax),%ecx
80105464:	89 4d 08             	mov    %ecx,0x8(%ebp)
80105467:	0f b6 12             	movzbl (%edx),%edx
8010546a:	88 10                	mov    %dl,(%eax)
8010546c:	0f b6 00             	movzbl (%eax),%eax
8010546f:	84 c0                	test   %al,%al
80105471:	75 d8                	jne    8010544b <safestrcpy+0x18>
    ;
  *s = 0;
80105473:	8b 45 08             	mov    0x8(%ebp),%eax
80105476:	c6 00 00             	movb   $0x0,(%eax)
  return os;
80105479:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
8010547c:	c9                   	leave  
8010547d:	c3                   	ret    

8010547e <strlen>:

int
strlen(const char *s)
{
8010547e:	55                   	push   %ebp
8010547f:	89 e5                	mov    %esp,%ebp
80105481:	83 ec 10             	sub    $0x10,%esp
  int n;

  for(n = 0; s[n]; n++)
80105484:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
8010548b:	eb 04                	jmp    80105491 <strlen+0x13>
8010548d:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80105491:	8b 55 fc             	mov    -0x4(%ebp),%edx
80105494:	8b 45 08             	mov    0x8(%ebp),%eax
80105497:	01 d0                	add    %edx,%eax
80105499:	0f b6 00             	movzbl (%eax),%eax
8010549c:	84 c0                	test   %al,%al
8010549e:	75 ed                	jne    8010548d <strlen+0xf>
    ;
  return n;
801054a0:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
801054a3:	c9                   	leave  
801054a4:	c3                   	ret    

801054a5 <swtch>:
# a struct context, and save its address in *old.
# Switch stacks to new and pop previously-saved registers.

.globl swtch
swtch:
  movl 4(%esp), %eax
801054a5:	8b 44 24 04          	mov    0x4(%esp),%eax
  movl 8(%esp), %edx
801054a9:	8b 54 24 08          	mov    0x8(%esp),%edx

  # Save old callee-save registers
  pushl %ebp
801054ad:	55                   	push   %ebp
  pushl %ebx
801054ae:	53                   	push   %ebx
  pushl %esi
801054af:	56                   	push   %esi
  pushl %edi
801054b0:	57                   	push   %edi

  # Switch stacks
  movl %esp, (%eax)
801054b1:	89 20                	mov    %esp,(%eax)
  movl %edx, %esp
801054b3:	89 d4                	mov    %edx,%esp

  # Load new callee-save registers
  popl %edi
801054b5:	5f                   	pop    %edi
  popl %esi
801054b6:	5e                   	pop    %esi
  popl %ebx
801054b7:	5b                   	pop    %ebx
  popl %ebp
801054b8:	5d                   	pop    %ebp
  ret
801054b9:	c3                   	ret    

801054ba <fetchint>:
// to a saved program counter, and then the first argument.

// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
801054ba:	55                   	push   %ebp
801054bb:	89 e5                	mov    %esp,%ebp
801054bd:	83 ec 18             	sub    $0x18,%esp
  struct proc *curproc = myproc();
801054c0:	e8 17 ee ff ff       	call   801042dc <myproc>
801054c5:	89 45 f4             	mov    %eax,-0xc(%ebp)

  if(addr >= curproc->sz || addr+4 > curproc->sz)
801054c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801054cb:	8b 00                	mov    (%eax),%eax
801054cd:	39 45 08             	cmp    %eax,0x8(%ebp)
801054d0:	73 0f                	jae    801054e1 <fetchint+0x27>
801054d2:	8b 45 08             	mov    0x8(%ebp),%eax
801054d5:	8d 50 04             	lea    0x4(%eax),%edx
801054d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801054db:	8b 00                	mov    (%eax),%eax
801054dd:	39 c2                	cmp    %eax,%edx
801054df:	76 07                	jbe    801054e8 <fetchint+0x2e>
    return -1;
801054e1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801054e6:	eb 0f                	jmp    801054f7 <fetchint+0x3d>
  *ip = *(int*)(addr);
801054e8:	8b 45 08             	mov    0x8(%ebp),%eax
801054eb:	8b 10                	mov    (%eax),%edx
801054ed:	8b 45 0c             	mov    0xc(%ebp),%eax
801054f0:	89 10                	mov    %edx,(%eax)
  return 0;
801054f2:	b8 00 00 00 00       	mov    $0x0,%eax
}
801054f7:	c9                   	leave  
801054f8:	c3                   	ret    

801054f9 <fetchstr>:
// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
801054f9:	55                   	push   %ebp
801054fa:	89 e5                	mov    %esp,%ebp
801054fc:	83 ec 18             	sub    $0x18,%esp
  char *s, *ep;
  struct proc *curproc = myproc();
801054ff:	e8 d8 ed ff ff       	call   801042dc <myproc>
80105504:	89 45 f0             	mov    %eax,-0x10(%ebp)

  if(addr >= curproc->sz)
80105507:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010550a:	8b 00                	mov    (%eax),%eax
8010550c:	39 45 08             	cmp    %eax,0x8(%ebp)
8010550f:	72 07                	jb     80105518 <fetchstr+0x1f>
    return -1;
80105511:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105516:	eb 41                	jmp    80105559 <fetchstr+0x60>
  *pp = (char*)addr;
80105518:	8b 55 08             	mov    0x8(%ebp),%edx
8010551b:	8b 45 0c             	mov    0xc(%ebp),%eax
8010551e:	89 10                	mov    %edx,(%eax)
  ep = (char*)curproc->sz;
80105520:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105523:	8b 00                	mov    (%eax),%eax
80105525:	89 45 ec             	mov    %eax,-0x14(%ebp)
  for(s = *pp; s < ep; s++){
80105528:	8b 45 0c             	mov    0xc(%ebp),%eax
8010552b:	8b 00                	mov    (%eax),%eax
8010552d:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105530:	eb 1a                	jmp    8010554c <fetchstr+0x53>
    if(*s == 0)
80105532:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105535:	0f b6 00             	movzbl (%eax),%eax
80105538:	84 c0                	test   %al,%al
8010553a:	75 0c                	jne    80105548 <fetchstr+0x4f>
      return s - *pp;
8010553c:	8b 45 0c             	mov    0xc(%ebp),%eax
8010553f:	8b 10                	mov    (%eax),%edx
80105541:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105544:	29 d0                	sub    %edx,%eax
80105546:	eb 11                	jmp    80105559 <fetchstr+0x60>
  for(s = *pp; s < ep; s++){
80105548:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010554c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010554f:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80105552:	72 de                	jb     80105532 <fetchstr+0x39>
  }
  return -1;
80105554:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105559:	c9                   	leave  
8010555a:	c3                   	ret    

8010555b <argint>:

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
8010555b:	55                   	push   %ebp
8010555c:	89 e5                	mov    %esp,%ebp
8010555e:	83 ec 08             	sub    $0x8,%esp
  return fetchint((myproc()->tf->esp) + 4 + 4*n, ip);
80105561:	e8 76 ed ff ff       	call   801042dc <myproc>
80105566:	8b 40 18             	mov    0x18(%eax),%eax
80105569:	8b 50 44             	mov    0x44(%eax),%edx
8010556c:	8b 45 08             	mov    0x8(%ebp),%eax
8010556f:	c1 e0 02             	shl    $0x2,%eax
80105572:	01 d0                	add    %edx,%eax
80105574:	83 c0 04             	add    $0x4,%eax
80105577:	83 ec 08             	sub    $0x8,%esp
8010557a:	ff 75 0c             	push   0xc(%ebp)
8010557d:	50                   	push   %eax
8010557e:	e8 37 ff ff ff       	call   801054ba <fetchint>
80105583:	83 c4 10             	add    $0x10,%esp
}
80105586:	c9                   	leave  
80105587:	c3                   	ret    

80105588 <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size bytes.  Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
80105588:	55                   	push   %ebp
80105589:	89 e5                	mov    %esp,%ebp
8010558b:	83 ec 18             	sub    $0x18,%esp
  int i;
  struct proc *curproc = myproc();
8010558e:	e8 49 ed ff ff       	call   801042dc <myproc>
80105593:	89 45 f4             	mov    %eax,-0xc(%ebp)
 
  if(argint(n, &i) < 0)
80105596:	83 ec 08             	sub    $0x8,%esp
80105599:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010559c:	50                   	push   %eax
8010559d:	ff 75 08             	push   0x8(%ebp)
801055a0:	e8 b6 ff ff ff       	call   8010555b <argint>
801055a5:	83 c4 10             	add    $0x10,%esp
801055a8:	85 c0                	test   %eax,%eax
801055aa:	79 07                	jns    801055b3 <argptr+0x2b>
    return -1;
801055ac:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801055b1:	eb 3b                	jmp    801055ee <argptr+0x66>
  if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz)
801055b3:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801055b7:	78 1f                	js     801055d8 <argptr+0x50>
801055b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801055bc:	8b 00                	mov    (%eax),%eax
801055be:	8b 55 f0             	mov    -0x10(%ebp),%edx
801055c1:	39 d0                	cmp    %edx,%eax
801055c3:	76 13                	jbe    801055d8 <argptr+0x50>
801055c5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801055c8:	89 c2                	mov    %eax,%edx
801055ca:	8b 45 10             	mov    0x10(%ebp),%eax
801055cd:	01 c2                	add    %eax,%edx
801055cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
801055d2:	8b 00                	mov    (%eax),%eax
801055d4:	39 c2                	cmp    %eax,%edx
801055d6:	76 07                	jbe    801055df <argptr+0x57>
    return -1;
801055d8:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801055dd:	eb 0f                	jmp    801055ee <argptr+0x66>
  *pp = (char*)i;
801055df:	8b 45 f0             	mov    -0x10(%ebp),%eax
801055e2:	89 c2                	mov    %eax,%edx
801055e4:	8b 45 0c             	mov    0xc(%ebp),%eax
801055e7:	89 10                	mov    %edx,(%eax)
  return 0;
801055e9:	b8 00 00 00 00       	mov    $0x0,%eax
}
801055ee:	c9                   	leave  
801055ef:	c3                   	ret    

801055f0 <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
801055f0:	55                   	push   %ebp
801055f1:	89 e5                	mov    %esp,%ebp
801055f3:	83 ec 18             	sub    $0x18,%esp
  int addr;
  if(argint(n, &addr) < 0)
801055f6:	83 ec 08             	sub    $0x8,%esp
801055f9:	8d 45 f4             	lea    -0xc(%ebp),%eax
801055fc:	50                   	push   %eax
801055fd:	ff 75 08             	push   0x8(%ebp)
80105600:	e8 56 ff ff ff       	call   8010555b <argint>
80105605:	83 c4 10             	add    $0x10,%esp
80105608:	85 c0                	test   %eax,%eax
8010560a:	79 07                	jns    80105613 <argstr+0x23>
    return -1;
8010560c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105611:	eb 12                	jmp    80105625 <argstr+0x35>
  return fetchstr(addr, pp);
80105613:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105616:	83 ec 08             	sub    $0x8,%esp
80105619:	ff 75 0c             	push   0xc(%ebp)
8010561c:	50                   	push   %eax
8010561d:	e8 d7 fe ff ff       	call   801054f9 <fetchstr>
80105622:	83 c4 10             	add    $0x10,%esp
}
80105625:	c9                   	leave  
80105626:	c3                   	ret    

80105627 <syscall>:
[SYS_get_free_frame_cnt] sys_get_free_frame_cnt,
};

void
syscall(void)
{
80105627:	55                   	push   %ebp
80105628:	89 e5                	mov    %esp,%ebp
8010562a:	83 ec 18             	sub    $0x18,%esp
  int num;
  struct proc *curproc = myproc();
8010562d:	e8 aa ec ff ff       	call   801042dc <myproc>
80105632:	89 45 f4             	mov    %eax,-0xc(%ebp)

  num = curproc->tf->eax;
80105635:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105638:	8b 40 18             	mov    0x18(%eax),%eax
8010563b:	8b 40 1c             	mov    0x1c(%eax),%eax
8010563e:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
80105641:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105645:	7e 2f                	jle    80105676 <syscall+0x4f>
80105647:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010564a:	83 f8 17             	cmp    $0x17,%eax
8010564d:	77 27                	ja     80105676 <syscall+0x4f>
8010564f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105652:	8b 04 85 20 b0 10 80 	mov    -0x7fef4fe0(,%eax,4),%eax
80105659:	85 c0                	test   %eax,%eax
8010565b:	74 19                	je     80105676 <syscall+0x4f>
    curproc->tf->eax = syscalls[num]();
8010565d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105660:	8b 04 85 20 b0 10 80 	mov    -0x7fef4fe0(,%eax,4),%eax
80105667:	ff d0                	call   *%eax
80105669:	89 c2                	mov    %eax,%edx
8010566b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010566e:	8b 40 18             	mov    0x18(%eax),%eax
80105671:	89 50 1c             	mov    %edx,0x1c(%eax)
80105674:	eb 2c                	jmp    801056a2 <syscall+0x7b>
  } else {
    cprintf("%d %s: unknown sys call %d\n",
            curproc->pid, curproc->name, num);
80105676:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105679:	8d 50 6c             	lea    0x6c(%eax),%edx
    cprintf("%d %s: unknown sys call %d\n",
8010567c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010567f:	8b 40 10             	mov    0x10(%eax),%eax
80105682:	ff 75 f0             	push   -0x10(%ebp)
80105685:	52                   	push   %edx
80105686:	50                   	push   %eax
80105687:	68 04 89 10 80       	push   $0x80108904
8010568c:	e8 6f ad ff ff       	call   80100400 <cprintf>
80105691:	83 c4 10             	add    $0x10,%esp
    curproc->tf->eax = -1;
80105694:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105697:	8b 40 18             	mov    0x18(%eax),%eax
8010569a:	c7 40 1c ff ff ff ff 	movl   $0xffffffff,0x1c(%eax)
  }
}
801056a1:	90                   	nop
801056a2:	90                   	nop
801056a3:	c9                   	leave  
801056a4:	c3                   	ret    

801056a5 <argfd>:

// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
{
801056a5:	55                   	push   %ebp
801056a6:	89 e5                	mov    %esp,%ebp
801056a8:	83 ec 18             	sub    $0x18,%esp
  int fd;
  struct file *f;

  if(argint(n, &fd) < 0)
801056ab:	83 ec 08             	sub    $0x8,%esp
801056ae:	8d 45 f0             	lea    -0x10(%ebp),%eax
801056b1:	50                   	push   %eax
801056b2:	ff 75 08             	push   0x8(%ebp)
801056b5:	e8 a1 fe ff ff       	call   8010555b <argint>
801056ba:	83 c4 10             	add    $0x10,%esp
801056bd:	85 c0                	test   %eax,%eax
801056bf:	79 07                	jns    801056c8 <argfd+0x23>
    return -1;
801056c1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801056c6:	eb 4f                	jmp    80105717 <argfd+0x72>
  if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0)
801056c8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801056cb:	85 c0                	test   %eax,%eax
801056cd:	78 20                	js     801056ef <argfd+0x4a>
801056cf:	8b 45 f0             	mov    -0x10(%ebp),%eax
801056d2:	83 f8 0f             	cmp    $0xf,%eax
801056d5:	7f 18                	jg     801056ef <argfd+0x4a>
801056d7:	e8 00 ec ff ff       	call   801042dc <myproc>
801056dc:	8b 55 f0             	mov    -0x10(%ebp),%edx
801056df:	83 c2 08             	add    $0x8,%edx
801056e2:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801056e6:	89 45 f4             	mov    %eax,-0xc(%ebp)
801056e9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801056ed:	75 07                	jne    801056f6 <argfd+0x51>
    return -1;
801056ef:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801056f4:	eb 21                	jmp    80105717 <argfd+0x72>
  if(pfd)
801056f6:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801056fa:	74 08                	je     80105704 <argfd+0x5f>
    *pfd = fd;
801056fc:	8b 55 f0             	mov    -0x10(%ebp),%edx
801056ff:	8b 45 0c             	mov    0xc(%ebp),%eax
80105702:	89 10                	mov    %edx,(%eax)
  if(pf)
80105704:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105708:	74 08                	je     80105712 <argfd+0x6d>
    *pf = f;
8010570a:	8b 45 10             	mov    0x10(%ebp),%eax
8010570d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105710:	89 10                	mov    %edx,(%eax)
  return 0;
80105712:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105717:	c9                   	leave  
80105718:	c3                   	ret    

80105719 <fdalloc>:

// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
80105719:	55                   	push   %ebp
8010571a:	89 e5                	mov    %esp,%ebp
8010571c:	83 ec 18             	sub    $0x18,%esp
  int fd;
  struct proc *curproc = myproc();
8010571f:	e8 b8 eb ff ff       	call   801042dc <myproc>
80105724:	89 45 f0             	mov    %eax,-0x10(%ebp)

  for(fd = 0; fd < NOFILE; fd++){
80105727:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010572e:	eb 2a                	jmp    8010575a <fdalloc+0x41>
    if(curproc->ofile[fd] == 0){
80105730:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105733:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105736:	83 c2 08             	add    $0x8,%edx
80105739:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
8010573d:	85 c0                	test   %eax,%eax
8010573f:	75 15                	jne    80105756 <fdalloc+0x3d>
      curproc->ofile[fd] = f;
80105741:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105744:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105747:	8d 4a 08             	lea    0x8(%edx),%ecx
8010574a:	8b 55 08             	mov    0x8(%ebp),%edx
8010574d:	89 54 88 08          	mov    %edx,0x8(%eax,%ecx,4)
      return fd;
80105751:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105754:	eb 0f                	jmp    80105765 <fdalloc+0x4c>
  for(fd = 0; fd < NOFILE; fd++){
80105756:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010575a:	83 7d f4 0f          	cmpl   $0xf,-0xc(%ebp)
8010575e:	7e d0                	jle    80105730 <fdalloc+0x17>
    }
  }
  return -1;
80105760:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105765:	c9                   	leave  
80105766:	c3                   	ret    

80105767 <sys_dup>:

int
sys_dup(void)
{
80105767:	55                   	push   %ebp
80105768:	89 e5                	mov    %esp,%ebp
8010576a:	83 ec 18             	sub    $0x18,%esp
  struct file *f;
  int fd;

  if(argfd(0, 0, &f) < 0)
8010576d:	83 ec 04             	sub    $0x4,%esp
80105770:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105773:	50                   	push   %eax
80105774:	6a 00                	push   $0x0
80105776:	6a 00                	push   $0x0
80105778:	e8 28 ff ff ff       	call   801056a5 <argfd>
8010577d:	83 c4 10             	add    $0x10,%esp
80105780:	85 c0                	test   %eax,%eax
80105782:	79 07                	jns    8010578b <sys_dup+0x24>
    return -1;
80105784:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105789:	eb 31                	jmp    801057bc <sys_dup+0x55>
  if((fd=fdalloc(f)) < 0)
8010578b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010578e:	83 ec 0c             	sub    $0xc,%esp
80105791:	50                   	push   %eax
80105792:	e8 82 ff ff ff       	call   80105719 <fdalloc>
80105797:	83 c4 10             	add    $0x10,%esp
8010579a:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010579d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801057a1:	79 07                	jns    801057aa <sys_dup+0x43>
    return -1;
801057a3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801057a8:	eb 12                	jmp    801057bc <sys_dup+0x55>
  filedup(f);
801057aa:	8b 45 f0             	mov    -0x10(%ebp),%eax
801057ad:	83 ec 0c             	sub    $0xc,%esp
801057b0:	50                   	push   %eax
801057b1:	e8 d7 b8 ff ff       	call   8010108d <filedup>
801057b6:	83 c4 10             	add    $0x10,%esp
  return fd;
801057b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
801057bc:	c9                   	leave  
801057bd:	c3                   	ret    

801057be <sys_read>:

int
sys_read(void)
{
801057be:	55                   	push   %ebp
801057bf:	89 e5                	mov    %esp,%ebp
801057c1:	83 ec 18             	sub    $0x18,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
801057c4:	83 ec 04             	sub    $0x4,%esp
801057c7:	8d 45 f4             	lea    -0xc(%ebp),%eax
801057ca:	50                   	push   %eax
801057cb:	6a 00                	push   $0x0
801057cd:	6a 00                	push   $0x0
801057cf:	e8 d1 fe ff ff       	call   801056a5 <argfd>
801057d4:	83 c4 10             	add    $0x10,%esp
801057d7:	85 c0                	test   %eax,%eax
801057d9:	78 2e                	js     80105809 <sys_read+0x4b>
801057db:	83 ec 08             	sub    $0x8,%esp
801057de:	8d 45 f0             	lea    -0x10(%ebp),%eax
801057e1:	50                   	push   %eax
801057e2:	6a 02                	push   $0x2
801057e4:	e8 72 fd ff ff       	call   8010555b <argint>
801057e9:	83 c4 10             	add    $0x10,%esp
801057ec:	85 c0                	test   %eax,%eax
801057ee:	78 19                	js     80105809 <sys_read+0x4b>
801057f0:	8b 45 f0             	mov    -0x10(%ebp),%eax
801057f3:	83 ec 04             	sub    $0x4,%esp
801057f6:	50                   	push   %eax
801057f7:	8d 45 ec             	lea    -0x14(%ebp),%eax
801057fa:	50                   	push   %eax
801057fb:	6a 01                	push   $0x1
801057fd:	e8 86 fd ff ff       	call   80105588 <argptr>
80105802:	83 c4 10             	add    $0x10,%esp
80105805:	85 c0                	test   %eax,%eax
80105807:	79 07                	jns    80105810 <sys_read+0x52>
    return -1;
80105809:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010580e:	eb 17                	jmp    80105827 <sys_read+0x69>
  return fileread(f, p, n);
80105810:	8b 4d f0             	mov    -0x10(%ebp),%ecx
80105813:	8b 55 ec             	mov    -0x14(%ebp),%edx
80105816:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105819:	83 ec 04             	sub    $0x4,%esp
8010581c:	51                   	push   %ecx
8010581d:	52                   	push   %edx
8010581e:	50                   	push   %eax
8010581f:	e8 f9 b9 ff ff       	call   8010121d <fileread>
80105824:	83 c4 10             	add    $0x10,%esp
}
80105827:	c9                   	leave  
80105828:	c3                   	ret    

80105829 <sys_write>:

int
sys_write(void)
{
80105829:	55                   	push   %ebp
8010582a:	89 e5                	mov    %esp,%ebp
8010582c:	83 ec 18             	sub    $0x18,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
8010582f:	83 ec 04             	sub    $0x4,%esp
80105832:	8d 45 f4             	lea    -0xc(%ebp),%eax
80105835:	50                   	push   %eax
80105836:	6a 00                	push   $0x0
80105838:	6a 00                	push   $0x0
8010583a:	e8 66 fe ff ff       	call   801056a5 <argfd>
8010583f:	83 c4 10             	add    $0x10,%esp
80105842:	85 c0                	test   %eax,%eax
80105844:	78 2e                	js     80105874 <sys_write+0x4b>
80105846:	83 ec 08             	sub    $0x8,%esp
80105849:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010584c:	50                   	push   %eax
8010584d:	6a 02                	push   $0x2
8010584f:	e8 07 fd ff ff       	call   8010555b <argint>
80105854:	83 c4 10             	add    $0x10,%esp
80105857:	85 c0                	test   %eax,%eax
80105859:	78 19                	js     80105874 <sys_write+0x4b>
8010585b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010585e:	83 ec 04             	sub    $0x4,%esp
80105861:	50                   	push   %eax
80105862:	8d 45 ec             	lea    -0x14(%ebp),%eax
80105865:	50                   	push   %eax
80105866:	6a 01                	push   $0x1
80105868:	e8 1b fd ff ff       	call   80105588 <argptr>
8010586d:	83 c4 10             	add    $0x10,%esp
80105870:	85 c0                	test   %eax,%eax
80105872:	79 07                	jns    8010587b <sys_write+0x52>
    return -1;
80105874:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105879:	eb 17                	jmp    80105892 <sys_write+0x69>
  return filewrite(f, p, n);
8010587b:	8b 4d f0             	mov    -0x10(%ebp),%ecx
8010587e:	8b 55 ec             	mov    -0x14(%ebp),%edx
80105881:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105884:	83 ec 04             	sub    $0x4,%esp
80105887:	51                   	push   %ecx
80105888:	52                   	push   %edx
80105889:	50                   	push   %eax
8010588a:	e8 46 ba ff ff       	call   801012d5 <filewrite>
8010588f:	83 c4 10             	add    $0x10,%esp
}
80105892:	c9                   	leave  
80105893:	c3                   	ret    

80105894 <sys_close>:

int
sys_close(void)
{
80105894:	55                   	push   %ebp
80105895:	89 e5                	mov    %esp,%ebp
80105897:	83 ec 18             	sub    $0x18,%esp
  int fd;
  struct file *f;

  if(argfd(0, &fd, &f) < 0)
8010589a:	83 ec 04             	sub    $0x4,%esp
8010589d:	8d 45 f0             	lea    -0x10(%ebp),%eax
801058a0:	50                   	push   %eax
801058a1:	8d 45 f4             	lea    -0xc(%ebp),%eax
801058a4:	50                   	push   %eax
801058a5:	6a 00                	push   $0x0
801058a7:	e8 f9 fd ff ff       	call   801056a5 <argfd>
801058ac:	83 c4 10             	add    $0x10,%esp
801058af:	85 c0                	test   %eax,%eax
801058b1:	79 07                	jns    801058ba <sys_close+0x26>
    return -1;
801058b3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801058b8:	eb 27                	jmp    801058e1 <sys_close+0x4d>
  myproc()->ofile[fd] = 0;
801058ba:	e8 1d ea ff ff       	call   801042dc <myproc>
801058bf:	8b 55 f4             	mov    -0xc(%ebp),%edx
801058c2:	83 c2 08             	add    $0x8,%edx
801058c5:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
801058cc:	00 
  fileclose(f);
801058cd:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058d0:	83 ec 0c             	sub    $0xc,%esp
801058d3:	50                   	push   %eax
801058d4:	e8 05 b8 ff ff       	call   801010de <fileclose>
801058d9:	83 c4 10             	add    $0x10,%esp
  return 0;
801058dc:	b8 00 00 00 00       	mov    $0x0,%eax
}
801058e1:	c9                   	leave  
801058e2:	c3                   	ret    

801058e3 <sys_fstat>:

int
sys_fstat(void)
{
801058e3:	55                   	push   %ebp
801058e4:	89 e5                	mov    %esp,%ebp
801058e6:	83 ec 18             	sub    $0x18,%esp
  struct file *f;
  struct stat *st;

  if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
801058e9:	83 ec 04             	sub    $0x4,%esp
801058ec:	8d 45 f4             	lea    -0xc(%ebp),%eax
801058ef:	50                   	push   %eax
801058f0:	6a 00                	push   $0x0
801058f2:	6a 00                	push   $0x0
801058f4:	e8 ac fd ff ff       	call   801056a5 <argfd>
801058f9:	83 c4 10             	add    $0x10,%esp
801058fc:	85 c0                	test   %eax,%eax
801058fe:	78 17                	js     80105917 <sys_fstat+0x34>
80105900:	83 ec 04             	sub    $0x4,%esp
80105903:	6a 14                	push   $0x14
80105905:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105908:	50                   	push   %eax
80105909:	6a 01                	push   $0x1
8010590b:	e8 78 fc ff ff       	call   80105588 <argptr>
80105910:	83 c4 10             	add    $0x10,%esp
80105913:	85 c0                	test   %eax,%eax
80105915:	79 07                	jns    8010591e <sys_fstat+0x3b>
    return -1;
80105917:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010591c:	eb 13                	jmp    80105931 <sys_fstat+0x4e>
  return filestat(f, st);
8010591e:	8b 55 f0             	mov    -0x10(%ebp),%edx
80105921:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105924:	83 ec 08             	sub    $0x8,%esp
80105927:	52                   	push   %edx
80105928:	50                   	push   %eax
80105929:	e8 98 b8 ff ff       	call   801011c6 <filestat>
8010592e:	83 c4 10             	add    $0x10,%esp
}
80105931:	c9                   	leave  
80105932:	c3                   	ret    

80105933 <sys_link>:

// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80105933:	55                   	push   %ebp
80105934:	89 e5                	mov    %esp,%ebp
80105936:	83 ec 28             	sub    $0x28,%esp
  char name[DIRSIZ], *new, *old;
  struct inode *dp, *ip;

  if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80105939:	83 ec 08             	sub    $0x8,%esp
8010593c:	8d 45 d8             	lea    -0x28(%ebp),%eax
8010593f:	50                   	push   %eax
80105940:	6a 00                	push   $0x0
80105942:	e8 a9 fc ff ff       	call   801055f0 <argstr>
80105947:	83 c4 10             	add    $0x10,%esp
8010594a:	85 c0                	test   %eax,%eax
8010594c:	78 15                	js     80105963 <sys_link+0x30>
8010594e:	83 ec 08             	sub    $0x8,%esp
80105951:	8d 45 dc             	lea    -0x24(%ebp),%eax
80105954:	50                   	push   %eax
80105955:	6a 01                	push   $0x1
80105957:	e8 94 fc ff ff       	call   801055f0 <argstr>
8010595c:	83 c4 10             	add    $0x10,%esp
8010595f:	85 c0                	test   %eax,%eax
80105961:	79 0a                	jns    8010596d <sys_link+0x3a>
    return -1;
80105963:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105968:	e9 68 01 00 00       	jmp    80105ad5 <sys_link+0x1a2>

  begin_op();
8010596d:	e8 ed db ff ff       	call   8010355f <begin_op>
  if((ip = namei(old)) == 0){
80105972:	8b 45 d8             	mov    -0x28(%ebp),%eax
80105975:	83 ec 0c             	sub    $0xc,%esp
80105978:	50                   	push   %eax
80105979:	e8 e2 cb ff ff       	call   80102560 <namei>
8010597e:	83 c4 10             	add    $0x10,%esp
80105981:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105984:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105988:	75 0f                	jne    80105999 <sys_link+0x66>
    end_op();
8010598a:	e8 5c dc ff ff       	call   801035eb <end_op>
    return -1;
8010598f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105994:	e9 3c 01 00 00       	jmp    80105ad5 <sys_link+0x1a2>
  }

  ilock(ip);
80105999:	83 ec 0c             	sub    $0xc,%esp
8010599c:	ff 75 f4             	push   -0xc(%ebp)
8010599f:	e8 89 c0 ff ff       	call   80101a2d <ilock>
801059a4:	83 c4 10             	add    $0x10,%esp
  if(ip->type == T_DIR){
801059a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801059aa:	0f b7 40 50          	movzwl 0x50(%eax),%eax
801059ae:	66 83 f8 01          	cmp    $0x1,%ax
801059b2:	75 1d                	jne    801059d1 <sys_link+0x9e>
    iunlockput(ip);
801059b4:	83 ec 0c             	sub    $0xc,%esp
801059b7:	ff 75 f4             	push   -0xc(%ebp)
801059ba:	e8 9f c2 ff ff       	call   80101c5e <iunlockput>
801059bf:	83 c4 10             	add    $0x10,%esp
    end_op();
801059c2:	e8 24 dc ff ff       	call   801035eb <end_op>
    return -1;
801059c7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801059cc:	e9 04 01 00 00       	jmp    80105ad5 <sys_link+0x1a2>
  }

  ip->nlink++;
801059d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801059d4:	0f b7 40 56          	movzwl 0x56(%eax),%eax
801059d8:	83 c0 01             	add    $0x1,%eax
801059db:	89 c2                	mov    %eax,%edx
801059dd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801059e0:	66 89 50 56          	mov    %dx,0x56(%eax)
  iupdate(ip);
801059e4:	83 ec 0c             	sub    $0xc,%esp
801059e7:	ff 75 f4             	push   -0xc(%ebp)
801059ea:	e8 61 be ff ff       	call   80101850 <iupdate>
801059ef:	83 c4 10             	add    $0x10,%esp
  iunlock(ip);
801059f2:	83 ec 0c             	sub    $0xc,%esp
801059f5:	ff 75 f4             	push   -0xc(%ebp)
801059f8:	e8 43 c1 ff ff       	call   80101b40 <iunlock>
801059fd:	83 c4 10             	add    $0x10,%esp

  if((dp = nameiparent(new, name)) == 0)
80105a00:	8b 45 dc             	mov    -0x24(%ebp),%eax
80105a03:	83 ec 08             	sub    $0x8,%esp
80105a06:	8d 55 e2             	lea    -0x1e(%ebp),%edx
80105a09:	52                   	push   %edx
80105a0a:	50                   	push   %eax
80105a0b:	e8 6c cb ff ff       	call   8010257c <nameiparent>
80105a10:	83 c4 10             	add    $0x10,%esp
80105a13:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105a16:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105a1a:	74 71                	je     80105a8d <sys_link+0x15a>
    goto bad;
  ilock(dp);
80105a1c:	83 ec 0c             	sub    $0xc,%esp
80105a1f:	ff 75 f0             	push   -0x10(%ebp)
80105a22:	e8 06 c0 ff ff       	call   80101a2d <ilock>
80105a27:	83 c4 10             	add    $0x10,%esp
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80105a2a:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105a2d:	8b 10                	mov    (%eax),%edx
80105a2f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a32:	8b 00                	mov    (%eax),%eax
80105a34:	39 c2                	cmp    %eax,%edx
80105a36:	75 1d                	jne    80105a55 <sys_link+0x122>
80105a38:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a3b:	8b 40 04             	mov    0x4(%eax),%eax
80105a3e:	83 ec 04             	sub    $0x4,%esp
80105a41:	50                   	push   %eax
80105a42:	8d 45 e2             	lea    -0x1e(%ebp),%eax
80105a45:	50                   	push   %eax
80105a46:	ff 75 f0             	push   -0x10(%ebp)
80105a49:	e8 7b c8 ff ff       	call   801022c9 <dirlink>
80105a4e:	83 c4 10             	add    $0x10,%esp
80105a51:	85 c0                	test   %eax,%eax
80105a53:	79 10                	jns    80105a65 <sys_link+0x132>
    iunlockput(dp);
80105a55:	83 ec 0c             	sub    $0xc,%esp
80105a58:	ff 75 f0             	push   -0x10(%ebp)
80105a5b:	e8 fe c1 ff ff       	call   80101c5e <iunlockput>
80105a60:	83 c4 10             	add    $0x10,%esp
    goto bad;
80105a63:	eb 29                	jmp    80105a8e <sys_link+0x15b>
  }
  iunlockput(dp);
80105a65:	83 ec 0c             	sub    $0xc,%esp
80105a68:	ff 75 f0             	push   -0x10(%ebp)
80105a6b:	e8 ee c1 ff ff       	call   80101c5e <iunlockput>
80105a70:	83 c4 10             	add    $0x10,%esp
  iput(ip);
80105a73:	83 ec 0c             	sub    $0xc,%esp
80105a76:	ff 75 f4             	push   -0xc(%ebp)
80105a79:	e8 10 c1 ff ff       	call   80101b8e <iput>
80105a7e:	83 c4 10             	add    $0x10,%esp

  end_op();
80105a81:	e8 65 db ff ff       	call   801035eb <end_op>

  return 0;
80105a86:	b8 00 00 00 00       	mov    $0x0,%eax
80105a8b:	eb 48                	jmp    80105ad5 <sys_link+0x1a2>
    goto bad;
80105a8d:	90                   	nop

bad:
  ilock(ip);
80105a8e:	83 ec 0c             	sub    $0xc,%esp
80105a91:	ff 75 f4             	push   -0xc(%ebp)
80105a94:	e8 94 bf ff ff       	call   80101a2d <ilock>
80105a99:	83 c4 10             	add    $0x10,%esp
  ip->nlink--;
80105a9c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a9f:	0f b7 40 56          	movzwl 0x56(%eax),%eax
80105aa3:	83 e8 01             	sub    $0x1,%eax
80105aa6:	89 c2                	mov    %eax,%edx
80105aa8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105aab:	66 89 50 56          	mov    %dx,0x56(%eax)
  iupdate(ip);
80105aaf:	83 ec 0c             	sub    $0xc,%esp
80105ab2:	ff 75 f4             	push   -0xc(%ebp)
80105ab5:	e8 96 bd ff ff       	call   80101850 <iupdate>
80105aba:	83 c4 10             	add    $0x10,%esp
  iunlockput(ip);
80105abd:	83 ec 0c             	sub    $0xc,%esp
80105ac0:	ff 75 f4             	push   -0xc(%ebp)
80105ac3:	e8 96 c1 ff ff       	call   80101c5e <iunlockput>
80105ac8:	83 c4 10             	add    $0x10,%esp
  end_op();
80105acb:	e8 1b db ff ff       	call   801035eb <end_op>
  return -1;
80105ad0:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105ad5:	c9                   	leave  
80105ad6:	c3                   	ret    

80105ad7 <isdirempty>:

// Is the directory dp empty except for "." and ".." ?
static int
isdirempty(struct inode *dp)
{
80105ad7:	55                   	push   %ebp
80105ad8:	89 e5                	mov    %esp,%ebp
80105ada:	83 ec 28             	sub    $0x28,%esp
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105add:	c7 45 f4 20 00 00 00 	movl   $0x20,-0xc(%ebp)
80105ae4:	eb 40                	jmp    80105b26 <isdirempty+0x4f>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105ae6:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105ae9:	6a 10                	push   $0x10
80105aeb:	50                   	push   %eax
80105aec:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80105aef:	50                   	push   %eax
80105af0:	ff 75 08             	push   0x8(%ebp)
80105af3:	e8 21 c4 ff ff       	call   80101f19 <readi>
80105af8:	83 c4 10             	add    $0x10,%esp
80105afb:	83 f8 10             	cmp    $0x10,%eax
80105afe:	74 0d                	je     80105b0d <isdirempty+0x36>
      panic("isdirempty: readi");
80105b00:	83 ec 0c             	sub    $0xc,%esp
80105b03:	68 20 89 10 80       	push   $0x80108920
80105b08:	e8 a8 aa ff ff       	call   801005b5 <panic>
    if(de.inum != 0)
80105b0d:	0f b7 45 e4          	movzwl -0x1c(%ebp),%eax
80105b11:	66 85 c0             	test   %ax,%ax
80105b14:	74 07                	je     80105b1d <isdirempty+0x46>
      return 0;
80105b16:	b8 00 00 00 00       	mov    $0x0,%eax
80105b1b:	eb 1b                	jmp    80105b38 <isdirempty+0x61>
  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105b1d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b20:	83 c0 10             	add    $0x10,%eax
80105b23:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105b26:	8b 45 08             	mov    0x8(%ebp),%eax
80105b29:	8b 50 58             	mov    0x58(%eax),%edx
80105b2c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b2f:	39 c2                	cmp    %eax,%edx
80105b31:	77 b3                	ja     80105ae6 <isdirempty+0xf>
  }
  return 1;
80105b33:	b8 01 00 00 00       	mov    $0x1,%eax
}
80105b38:	c9                   	leave  
80105b39:	c3                   	ret    

80105b3a <sys_unlink>:

//PAGEBREAK!
int
sys_unlink(void)
{
80105b3a:	55                   	push   %ebp
80105b3b:	89 e5                	mov    %esp,%ebp
80105b3d:	83 ec 38             	sub    $0x38,%esp
  struct inode *ip, *dp;
  struct dirent de;
  char name[DIRSIZ], *path;
  uint off;

  if(argstr(0, &path) < 0)
80105b40:	83 ec 08             	sub    $0x8,%esp
80105b43:	8d 45 cc             	lea    -0x34(%ebp),%eax
80105b46:	50                   	push   %eax
80105b47:	6a 00                	push   $0x0
80105b49:	e8 a2 fa ff ff       	call   801055f0 <argstr>
80105b4e:	83 c4 10             	add    $0x10,%esp
80105b51:	85 c0                	test   %eax,%eax
80105b53:	79 0a                	jns    80105b5f <sys_unlink+0x25>
    return -1;
80105b55:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105b5a:	e9 bf 01 00 00       	jmp    80105d1e <sys_unlink+0x1e4>

  begin_op();
80105b5f:	e8 fb d9 ff ff       	call   8010355f <begin_op>
  if((dp = nameiparent(path, name)) == 0){
80105b64:	8b 45 cc             	mov    -0x34(%ebp),%eax
80105b67:	83 ec 08             	sub    $0x8,%esp
80105b6a:	8d 55 d2             	lea    -0x2e(%ebp),%edx
80105b6d:	52                   	push   %edx
80105b6e:	50                   	push   %eax
80105b6f:	e8 08 ca ff ff       	call   8010257c <nameiparent>
80105b74:	83 c4 10             	add    $0x10,%esp
80105b77:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105b7a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105b7e:	75 0f                	jne    80105b8f <sys_unlink+0x55>
    end_op();
80105b80:	e8 66 da ff ff       	call   801035eb <end_op>
    return -1;
80105b85:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105b8a:	e9 8f 01 00 00       	jmp    80105d1e <sys_unlink+0x1e4>
  }

  ilock(dp);
80105b8f:	83 ec 0c             	sub    $0xc,%esp
80105b92:	ff 75 f4             	push   -0xc(%ebp)
80105b95:	e8 93 be ff ff       	call   80101a2d <ilock>
80105b9a:	83 c4 10             	add    $0x10,%esp

  // Cannot unlink "." or "..".
  if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80105b9d:	83 ec 08             	sub    $0x8,%esp
80105ba0:	68 32 89 10 80       	push   $0x80108932
80105ba5:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105ba8:	50                   	push   %eax
80105ba9:	e8 46 c6 ff ff       	call   801021f4 <namecmp>
80105bae:	83 c4 10             	add    $0x10,%esp
80105bb1:	85 c0                	test   %eax,%eax
80105bb3:	0f 84 49 01 00 00    	je     80105d02 <sys_unlink+0x1c8>
80105bb9:	83 ec 08             	sub    $0x8,%esp
80105bbc:	68 34 89 10 80       	push   $0x80108934
80105bc1:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105bc4:	50                   	push   %eax
80105bc5:	e8 2a c6 ff ff       	call   801021f4 <namecmp>
80105bca:	83 c4 10             	add    $0x10,%esp
80105bcd:	85 c0                	test   %eax,%eax
80105bcf:	0f 84 2d 01 00 00    	je     80105d02 <sys_unlink+0x1c8>
    goto bad;

  if((ip = dirlookup(dp, name, &off)) == 0)
80105bd5:	83 ec 04             	sub    $0x4,%esp
80105bd8:	8d 45 c8             	lea    -0x38(%ebp),%eax
80105bdb:	50                   	push   %eax
80105bdc:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105bdf:	50                   	push   %eax
80105be0:	ff 75 f4             	push   -0xc(%ebp)
80105be3:	e8 27 c6 ff ff       	call   8010220f <dirlookup>
80105be8:	83 c4 10             	add    $0x10,%esp
80105beb:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105bee:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105bf2:	0f 84 0d 01 00 00    	je     80105d05 <sys_unlink+0x1cb>
    goto bad;
  ilock(ip);
80105bf8:	83 ec 0c             	sub    $0xc,%esp
80105bfb:	ff 75 f0             	push   -0x10(%ebp)
80105bfe:	e8 2a be ff ff       	call   80101a2d <ilock>
80105c03:	83 c4 10             	add    $0x10,%esp

  if(ip->nlink < 1)
80105c06:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105c09:	0f b7 40 56          	movzwl 0x56(%eax),%eax
80105c0d:	66 85 c0             	test   %ax,%ax
80105c10:	7f 0d                	jg     80105c1f <sys_unlink+0xe5>
    panic("unlink: nlink < 1");
80105c12:	83 ec 0c             	sub    $0xc,%esp
80105c15:	68 37 89 10 80       	push   $0x80108937
80105c1a:	e8 96 a9 ff ff       	call   801005b5 <panic>
  if(ip->type == T_DIR && !isdirempty(ip)){
80105c1f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105c22:	0f b7 40 50          	movzwl 0x50(%eax),%eax
80105c26:	66 83 f8 01          	cmp    $0x1,%ax
80105c2a:	75 25                	jne    80105c51 <sys_unlink+0x117>
80105c2c:	83 ec 0c             	sub    $0xc,%esp
80105c2f:	ff 75 f0             	push   -0x10(%ebp)
80105c32:	e8 a0 fe ff ff       	call   80105ad7 <isdirempty>
80105c37:	83 c4 10             	add    $0x10,%esp
80105c3a:	85 c0                	test   %eax,%eax
80105c3c:	75 13                	jne    80105c51 <sys_unlink+0x117>
    iunlockput(ip);
80105c3e:	83 ec 0c             	sub    $0xc,%esp
80105c41:	ff 75 f0             	push   -0x10(%ebp)
80105c44:	e8 15 c0 ff ff       	call   80101c5e <iunlockput>
80105c49:	83 c4 10             	add    $0x10,%esp
    goto bad;
80105c4c:	e9 b5 00 00 00       	jmp    80105d06 <sys_unlink+0x1cc>
  }

  memset(&de, 0, sizeof(de));
80105c51:	83 ec 04             	sub    $0x4,%esp
80105c54:	6a 10                	push   $0x10
80105c56:	6a 00                	push   $0x0
80105c58:	8d 45 e0             	lea    -0x20(%ebp),%eax
80105c5b:	50                   	push   %eax
80105c5c:	e8 cf f5 ff ff       	call   80105230 <memset>
80105c61:	83 c4 10             	add    $0x10,%esp
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105c64:	8b 45 c8             	mov    -0x38(%ebp),%eax
80105c67:	6a 10                	push   $0x10
80105c69:	50                   	push   %eax
80105c6a:	8d 45 e0             	lea    -0x20(%ebp),%eax
80105c6d:	50                   	push   %eax
80105c6e:	ff 75 f4             	push   -0xc(%ebp)
80105c71:	e8 f8 c3 ff ff       	call   8010206e <writei>
80105c76:	83 c4 10             	add    $0x10,%esp
80105c79:	83 f8 10             	cmp    $0x10,%eax
80105c7c:	74 0d                	je     80105c8b <sys_unlink+0x151>
    panic("unlink: writei");
80105c7e:	83 ec 0c             	sub    $0xc,%esp
80105c81:	68 49 89 10 80       	push   $0x80108949
80105c86:	e8 2a a9 ff ff       	call   801005b5 <panic>
  if(ip->type == T_DIR){
80105c8b:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105c8e:	0f b7 40 50          	movzwl 0x50(%eax),%eax
80105c92:	66 83 f8 01          	cmp    $0x1,%ax
80105c96:	75 21                	jne    80105cb9 <sys_unlink+0x17f>
    dp->nlink--;
80105c98:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105c9b:	0f b7 40 56          	movzwl 0x56(%eax),%eax
80105c9f:	83 e8 01             	sub    $0x1,%eax
80105ca2:	89 c2                	mov    %eax,%edx
80105ca4:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105ca7:	66 89 50 56          	mov    %dx,0x56(%eax)
    iupdate(dp);
80105cab:	83 ec 0c             	sub    $0xc,%esp
80105cae:	ff 75 f4             	push   -0xc(%ebp)
80105cb1:	e8 9a bb ff ff       	call   80101850 <iupdate>
80105cb6:	83 c4 10             	add    $0x10,%esp
  }
  iunlockput(dp);
80105cb9:	83 ec 0c             	sub    $0xc,%esp
80105cbc:	ff 75 f4             	push   -0xc(%ebp)
80105cbf:	e8 9a bf ff ff       	call   80101c5e <iunlockput>
80105cc4:	83 c4 10             	add    $0x10,%esp

  ip->nlink--;
80105cc7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cca:	0f b7 40 56          	movzwl 0x56(%eax),%eax
80105cce:	83 e8 01             	sub    $0x1,%eax
80105cd1:	89 c2                	mov    %eax,%edx
80105cd3:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cd6:	66 89 50 56          	mov    %dx,0x56(%eax)
  iupdate(ip);
80105cda:	83 ec 0c             	sub    $0xc,%esp
80105cdd:	ff 75 f0             	push   -0x10(%ebp)
80105ce0:	e8 6b bb ff ff       	call   80101850 <iupdate>
80105ce5:	83 c4 10             	add    $0x10,%esp
  iunlockput(ip);
80105ce8:	83 ec 0c             	sub    $0xc,%esp
80105ceb:	ff 75 f0             	push   -0x10(%ebp)
80105cee:	e8 6b bf ff ff       	call   80101c5e <iunlockput>
80105cf3:	83 c4 10             	add    $0x10,%esp

  end_op();
80105cf6:	e8 f0 d8 ff ff       	call   801035eb <end_op>

  return 0;
80105cfb:	b8 00 00 00 00       	mov    $0x0,%eax
80105d00:	eb 1c                	jmp    80105d1e <sys_unlink+0x1e4>
    goto bad;
80105d02:	90                   	nop
80105d03:	eb 01                	jmp    80105d06 <sys_unlink+0x1cc>
    goto bad;
80105d05:	90                   	nop

bad:
  iunlockput(dp);
80105d06:	83 ec 0c             	sub    $0xc,%esp
80105d09:	ff 75 f4             	push   -0xc(%ebp)
80105d0c:	e8 4d bf ff ff       	call   80101c5e <iunlockput>
80105d11:	83 c4 10             	add    $0x10,%esp
  end_op();
80105d14:	e8 d2 d8 ff ff       	call   801035eb <end_op>
  return -1;
80105d19:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105d1e:	c9                   	leave  
80105d1f:	c3                   	ret    

80105d20 <create>:

static struct inode*
create(char *path, short type, short major, short minor)
{
80105d20:	55                   	push   %ebp
80105d21:	89 e5                	mov    %esp,%ebp
80105d23:	83 ec 38             	sub    $0x38,%esp
80105d26:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80105d29:	8b 55 10             	mov    0x10(%ebp),%edx
80105d2c:	8b 45 14             	mov    0x14(%ebp),%eax
80105d2f:	66 89 4d d4          	mov    %cx,-0x2c(%ebp)
80105d33:	66 89 55 d0          	mov    %dx,-0x30(%ebp)
80105d37:	66 89 45 cc          	mov    %ax,-0x34(%ebp)
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];

  if((dp = nameiparent(path, name)) == 0)
80105d3b:	83 ec 08             	sub    $0x8,%esp
80105d3e:	8d 45 de             	lea    -0x22(%ebp),%eax
80105d41:	50                   	push   %eax
80105d42:	ff 75 08             	push   0x8(%ebp)
80105d45:	e8 32 c8 ff ff       	call   8010257c <nameiparent>
80105d4a:	83 c4 10             	add    $0x10,%esp
80105d4d:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105d50:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105d54:	75 0a                	jne    80105d60 <create+0x40>
    return 0;
80105d56:	b8 00 00 00 00       	mov    $0x0,%eax
80105d5b:	e9 90 01 00 00       	jmp    80105ef0 <create+0x1d0>
  ilock(dp);
80105d60:	83 ec 0c             	sub    $0xc,%esp
80105d63:	ff 75 f4             	push   -0xc(%ebp)
80105d66:	e8 c2 bc ff ff       	call   80101a2d <ilock>
80105d6b:	83 c4 10             	add    $0x10,%esp

  if((ip = dirlookup(dp, name, &off)) != 0){
80105d6e:	83 ec 04             	sub    $0x4,%esp
80105d71:	8d 45 ec             	lea    -0x14(%ebp),%eax
80105d74:	50                   	push   %eax
80105d75:	8d 45 de             	lea    -0x22(%ebp),%eax
80105d78:	50                   	push   %eax
80105d79:	ff 75 f4             	push   -0xc(%ebp)
80105d7c:	e8 8e c4 ff ff       	call   8010220f <dirlookup>
80105d81:	83 c4 10             	add    $0x10,%esp
80105d84:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105d87:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105d8b:	74 50                	je     80105ddd <create+0xbd>
    iunlockput(dp);
80105d8d:	83 ec 0c             	sub    $0xc,%esp
80105d90:	ff 75 f4             	push   -0xc(%ebp)
80105d93:	e8 c6 be ff ff       	call   80101c5e <iunlockput>
80105d98:	83 c4 10             	add    $0x10,%esp
    ilock(ip);
80105d9b:	83 ec 0c             	sub    $0xc,%esp
80105d9e:	ff 75 f0             	push   -0x10(%ebp)
80105da1:	e8 87 bc ff ff       	call   80101a2d <ilock>
80105da6:	83 c4 10             	add    $0x10,%esp
    if(type == T_FILE && ip->type == T_FILE)
80105da9:	66 83 7d d4 02       	cmpw   $0x2,-0x2c(%ebp)
80105dae:	75 15                	jne    80105dc5 <create+0xa5>
80105db0:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105db3:	0f b7 40 50          	movzwl 0x50(%eax),%eax
80105db7:	66 83 f8 02          	cmp    $0x2,%ax
80105dbb:	75 08                	jne    80105dc5 <create+0xa5>
      return ip;
80105dbd:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105dc0:	e9 2b 01 00 00       	jmp    80105ef0 <create+0x1d0>
    iunlockput(ip);
80105dc5:	83 ec 0c             	sub    $0xc,%esp
80105dc8:	ff 75 f0             	push   -0x10(%ebp)
80105dcb:	e8 8e be ff ff       	call   80101c5e <iunlockput>
80105dd0:	83 c4 10             	add    $0x10,%esp
    return 0;
80105dd3:	b8 00 00 00 00       	mov    $0x0,%eax
80105dd8:	e9 13 01 00 00       	jmp    80105ef0 <create+0x1d0>
  }

  if((ip = ialloc(dp->dev, type)) == 0)
80105ddd:	0f bf 55 d4          	movswl -0x2c(%ebp),%edx
80105de1:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105de4:	8b 00                	mov    (%eax),%eax
80105de6:	83 ec 08             	sub    $0x8,%esp
80105de9:	52                   	push   %edx
80105dea:	50                   	push   %eax
80105deb:	e8 89 b9 ff ff       	call   80101779 <ialloc>
80105df0:	83 c4 10             	add    $0x10,%esp
80105df3:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105df6:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105dfa:	75 0d                	jne    80105e09 <create+0xe9>
    panic("create: ialloc");
80105dfc:	83 ec 0c             	sub    $0xc,%esp
80105dff:	68 58 89 10 80       	push   $0x80108958
80105e04:	e8 ac a7 ff ff       	call   801005b5 <panic>

  ilock(ip);
80105e09:	83 ec 0c             	sub    $0xc,%esp
80105e0c:	ff 75 f0             	push   -0x10(%ebp)
80105e0f:	e8 19 bc ff ff       	call   80101a2d <ilock>
80105e14:	83 c4 10             	add    $0x10,%esp
  ip->major = major;
80105e17:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e1a:	0f b7 55 d0          	movzwl -0x30(%ebp),%edx
80105e1e:	66 89 50 52          	mov    %dx,0x52(%eax)
  ip->minor = minor;
80105e22:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e25:	0f b7 55 cc          	movzwl -0x34(%ebp),%edx
80105e29:	66 89 50 54          	mov    %dx,0x54(%eax)
  ip->nlink = 1;
80105e2d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e30:	66 c7 40 56 01 00    	movw   $0x1,0x56(%eax)
  iupdate(ip);
80105e36:	83 ec 0c             	sub    $0xc,%esp
80105e39:	ff 75 f0             	push   -0x10(%ebp)
80105e3c:	e8 0f ba ff ff       	call   80101850 <iupdate>
80105e41:	83 c4 10             	add    $0x10,%esp

  if(type == T_DIR){  // Create . and .. entries.
80105e44:	66 83 7d d4 01       	cmpw   $0x1,-0x2c(%ebp)
80105e49:	75 6a                	jne    80105eb5 <create+0x195>
    dp->nlink++;  // for ".."
80105e4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e4e:	0f b7 40 56          	movzwl 0x56(%eax),%eax
80105e52:	83 c0 01             	add    $0x1,%eax
80105e55:	89 c2                	mov    %eax,%edx
80105e57:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e5a:	66 89 50 56          	mov    %dx,0x56(%eax)
    iupdate(dp);
80105e5e:	83 ec 0c             	sub    $0xc,%esp
80105e61:	ff 75 f4             	push   -0xc(%ebp)
80105e64:	e8 e7 b9 ff ff       	call   80101850 <iupdate>
80105e69:	83 c4 10             	add    $0x10,%esp
    // No ip->nlink++ for ".": avoid cyclic ref count.
    if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80105e6c:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e6f:	8b 40 04             	mov    0x4(%eax),%eax
80105e72:	83 ec 04             	sub    $0x4,%esp
80105e75:	50                   	push   %eax
80105e76:	68 32 89 10 80       	push   $0x80108932
80105e7b:	ff 75 f0             	push   -0x10(%ebp)
80105e7e:	e8 46 c4 ff ff       	call   801022c9 <dirlink>
80105e83:	83 c4 10             	add    $0x10,%esp
80105e86:	85 c0                	test   %eax,%eax
80105e88:	78 1e                	js     80105ea8 <create+0x188>
80105e8a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e8d:	8b 40 04             	mov    0x4(%eax),%eax
80105e90:	83 ec 04             	sub    $0x4,%esp
80105e93:	50                   	push   %eax
80105e94:	68 34 89 10 80       	push   $0x80108934
80105e99:	ff 75 f0             	push   -0x10(%ebp)
80105e9c:	e8 28 c4 ff ff       	call   801022c9 <dirlink>
80105ea1:	83 c4 10             	add    $0x10,%esp
80105ea4:	85 c0                	test   %eax,%eax
80105ea6:	79 0d                	jns    80105eb5 <create+0x195>
      panic("create dots");
80105ea8:	83 ec 0c             	sub    $0xc,%esp
80105eab:	68 67 89 10 80       	push   $0x80108967
80105eb0:	e8 00 a7 ff ff       	call   801005b5 <panic>
  }

  if(dirlink(dp, name, ip->inum) < 0)
80105eb5:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105eb8:	8b 40 04             	mov    0x4(%eax),%eax
80105ebb:	83 ec 04             	sub    $0x4,%esp
80105ebe:	50                   	push   %eax
80105ebf:	8d 45 de             	lea    -0x22(%ebp),%eax
80105ec2:	50                   	push   %eax
80105ec3:	ff 75 f4             	push   -0xc(%ebp)
80105ec6:	e8 fe c3 ff ff       	call   801022c9 <dirlink>
80105ecb:	83 c4 10             	add    $0x10,%esp
80105ece:	85 c0                	test   %eax,%eax
80105ed0:	79 0d                	jns    80105edf <create+0x1bf>
    panic("create: dirlink");
80105ed2:	83 ec 0c             	sub    $0xc,%esp
80105ed5:	68 73 89 10 80       	push   $0x80108973
80105eda:	e8 d6 a6 ff ff       	call   801005b5 <panic>

  iunlockput(dp);
80105edf:	83 ec 0c             	sub    $0xc,%esp
80105ee2:	ff 75 f4             	push   -0xc(%ebp)
80105ee5:	e8 74 bd ff ff       	call   80101c5e <iunlockput>
80105eea:	83 c4 10             	add    $0x10,%esp

  return ip;
80105eed:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80105ef0:	c9                   	leave  
80105ef1:	c3                   	ret    

80105ef2 <sys_open>:

int
sys_open(void)
{
80105ef2:	55                   	push   %ebp
80105ef3:	89 e5                	mov    %esp,%ebp
80105ef5:	83 ec 28             	sub    $0x28,%esp
  char *path;
  int fd, omode;
  struct file *f;
  struct inode *ip;

  if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105ef8:	83 ec 08             	sub    $0x8,%esp
80105efb:	8d 45 e8             	lea    -0x18(%ebp),%eax
80105efe:	50                   	push   %eax
80105eff:	6a 00                	push   $0x0
80105f01:	e8 ea f6 ff ff       	call   801055f0 <argstr>
80105f06:	83 c4 10             	add    $0x10,%esp
80105f09:	85 c0                	test   %eax,%eax
80105f0b:	78 15                	js     80105f22 <sys_open+0x30>
80105f0d:	83 ec 08             	sub    $0x8,%esp
80105f10:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80105f13:	50                   	push   %eax
80105f14:	6a 01                	push   $0x1
80105f16:	e8 40 f6 ff ff       	call   8010555b <argint>
80105f1b:	83 c4 10             	add    $0x10,%esp
80105f1e:	85 c0                	test   %eax,%eax
80105f20:	79 0a                	jns    80105f2c <sys_open+0x3a>
    return -1;
80105f22:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105f27:	e9 61 01 00 00       	jmp    8010608d <sys_open+0x19b>

  begin_op();
80105f2c:	e8 2e d6 ff ff       	call   8010355f <begin_op>

  if(omode & O_CREATE){
80105f31:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105f34:	25 00 02 00 00       	and    $0x200,%eax
80105f39:	85 c0                	test   %eax,%eax
80105f3b:	74 2a                	je     80105f67 <sys_open+0x75>
    ip = create(path, T_FILE, 0, 0);
80105f3d:	8b 45 e8             	mov    -0x18(%ebp),%eax
80105f40:	6a 00                	push   $0x0
80105f42:	6a 00                	push   $0x0
80105f44:	6a 02                	push   $0x2
80105f46:	50                   	push   %eax
80105f47:	e8 d4 fd ff ff       	call   80105d20 <create>
80105f4c:	83 c4 10             	add    $0x10,%esp
80105f4f:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if(ip == 0){
80105f52:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105f56:	75 75                	jne    80105fcd <sys_open+0xdb>
      end_op();
80105f58:	e8 8e d6 ff ff       	call   801035eb <end_op>
      return -1;
80105f5d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105f62:	e9 26 01 00 00       	jmp    8010608d <sys_open+0x19b>
    }
  } else {
    if((ip = namei(path)) == 0){
80105f67:	8b 45 e8             	mov    -0x18(%ebp),%eax
80105f6a:	83 ec 0c             	sub    $0xc,%esp
80105f6d:	50                   	push   %eax
80105f6e:	e8 ed c5 ff ff       	call   80102560 <namei>
80105f73:	83 c4 10             	add    $0x10,%esp
80105f76:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105f79:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105f7d:	75 0f                	jne    80105f8e <sys_open+0x9c>
      end_op();
80105f7f:	e8 67 d6 ff ff       	call   801035eb <end_op>
      return -1;
80105f84:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105f89:	e9 ff 00 00 00       	jmp    8010608d <sys_open+0x19b>
    }
    ilock(ip);
80105f8e:	83 ec 0c             	sub    $0xc,%esp
80105f91:	ff 75 f4             	push   -0xc(%ebp)
80105f94:	e8 94 ba ff ff       	call   80101a2d <ilock>
80105f99:	83 c4 10             	add    $0x10,%esp
    if(ip->type == T_DIR && omode != O_RDONLY){
80105f9c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f9f:	0f b7 40 50          	movzwl 0x50(%eax),%eax
80105fa3:	66 83 f8 01          	cmp    $0x1,%ax
80105fa7:	75 24                	jne    80105fcd <sys_open+0xdb>
80105fa9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105fac:	85 c0                	test   %eax,%eax
80105fae:	74 1d                	je     80105fcd <sys_open+0xdb>
      iunlockput(ip);
80105fb0:	83 ec 0c             	sub    $0xc,%esp
80105fb3:	ff 75 f4             	push   -0xc(%ebp)
80105fb6:	e8 a3 bc ff ff       	call   80101c5e <iunlockput>
80105fbb:	83 c4 10             	add    $0x10,%esp
      end_op();
80105fbe:	e8 28 d6 ff ff       	call   801035eb <end_op>
      return -1;
80105fc3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105fc8:	e9 c0 00 00 00       	jmp    8010608d <sys_open+0x19b>
    }
  }

  if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
80105fcd:	e8 4e b0 ff ff       	call   80101020 <filealloc>
80105fd2:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105fd5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105fd9:	74 17                	je     80105ff2 <sys_open+0x100>
80105fdb:	83 ec 0c             	sub    $0xc,%esp
80105fde:	ff 75 f0             	push   -0x10(%ebp)
80105fe1:	e8 33 f7 ff ff       	call   80105719 <fdalloc>
80105fe6:	83 c4 10             	add    $0x10,%esp
80105fe9:	89 45 ec             	mov    %eax,-0x14(%ebp)
80105fec:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80105ff0:	79 2e                	jns    80106020 <sys_open+0x12e>
    if(f)
80105ff2:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105ff6:	74 0e                	je     80106006 <sys_open+0x114>
      fileclose(f);
80105ff8:	83 ec 0c             	sub    $0xc,%esp
80105ffb:	ff 75 f0             	push   -0x10(%ebp)
80105ffe:	e8 db b0 ff ff       	call   801010de <fileclose>
80106003:	83 c4 10             	add    $0x10,%esp
    iunlockput(ip);
80106006:	83 ec 0c             	sub    $0xc,%esp
80106009:	ff 75 f4             	push   -0xc(%ebp)
8010600c:	e8 4d bc ff ff       	call   80101c5e <iunlockput>
80106011:	83 c4 10             	add    $0x10,%esp
    end_op();
80106014:	e8 d2 d5 ff ff       	call   801035eb <end_op>
    return -1;
80106019:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010601e:	eb 6d                	jmp    8010608d <sys_open+0x19b>
  }
  iunlock(ip);
80106020:	83 ec 0c             	sub    $0xc,%esp
80106023:	ff 75 f4             	push   -0xc(%ebp)
80106026:	e8 15 bb ff ff       	call   80101b40 <iunlock>
8010602b:	83 c4 10             	add    $0x10,%esp
  end_op();
8010602e:	e8 b8 d5 ff ff       	call   801035eb <end_op>

  f->type = FD_INODE;
80106033:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106036:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
  f->ip = ip;
8010603c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010603f:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106042:	89 50 10             	mov    %edx,0x10(%eax)
  f->off = 0;
80106045:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106048:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
  f->readable = !(omode & O_WRONLY);
8010604f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106052:	83 e0 01             	and    $0x1,%eax
80106055:	85 c0                	test   %eax,%eax
80106057:	0f 94 c0             	sete   %al
8010605a:	89 c2                	mov    %eax,%edx
8010605c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010605f:	88 50 08             	mov    %dl,0x8(%eax)
  f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80106062:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106065:	83 e0 01             	and    $0x1,%eax
80106068:	85 c0                	test   %eax,%eax
8010606a:	75 0a                	jne    80106076 <sys_open+0x184>
8010606c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
8010606f:	83 e0 02             	and    $0x2,%eax
80106072:	85 c0                	test   %eax,%eax
80106074:	74 07                	je     8010607d <sys_open+0x18b>
80106076:	b8 01 00 00 00       	mov    $0x1,%eax
8010607b:	eb 05                	jmp    80106082 <sys_open+0x190>
8010607d:	b8 00 00 00 00       	mov    $0x0,%eax
80106082:	89 c2                	mov    %eax,%edx
80106084:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106087:	88 50 09             	mov    %dl,0x9(%eax)
  return fd;
8010608a:	8b 45 ec             	mov    -0x14(%ebp),%eax
}
8010608d:	c9                   	leave  
8010608e:	c3                   	ret    

8010608f <sys_mkdir>:

int
sys_mkdir(void)
{
8010608f:	55                   	push   %ebp
80106090:	89 e5                	mov    %esp,%ebp
80106092:	83 ec 18             	sub    $0x18,%esp
  char *path;
  struct inode *ip;

  begin_op();
80106095:	e8 c5 d4 ff ff       	call   8010355f <begin_op>
  if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
8010609a:	83 ec 08             	sub    $0x8,%esp
8010609d:	8d 45 f0             	lea    -0x10(%ebp),%eax
801060a0:	50                   	push   %eax
801060a1:	6a 00                	push   $0x0
801060a3:	e8 48 f5 ff ff       	call   801055f0 <argstr>
801060a8:	83 c4 10             	add    $0x10,%esp
801060ab:	85 c0                	test   %eax,%eax
801060ad:	78 1b                	js     801060ca <sys_mkdir+0x3b>
801060af:	8b 45 f0             	mov    -0x10(%ebp),%eax
801060b2:	6a 00                	push   $0x0
801060b4:	6a 00                	push   $0x0
801060b6:	6a 01                	push   $0x1
801060b8:	50                   	push   %eax
801060b9:	e8 62 fc ff ff       	call   80105d20 <create>
801060be:	83 c4 10             	add    $0x10,%esp
801060c1:	89 45 f4             	mov    %eax,-0xc(%ebp)
801060c4:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801060c8:	75 0c                	jne    801060d6 <sys_mkdir+0x47>
    end_op();
801060ca:	e8 1c d5 ff ff       	call   801035eb <end_op>
    return -1;
801060cf:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801060d4:	eb 18                	jmp    801060ee <sys_mkdir+0x5f>
  }
  iunlockput(ip);
801060d6:	83 ec 0c             	sub    $0xc,%esp
801060d9:	ff 75 f4             	push   -0xc(%ebp)
801060dc:	e8 7d bb ff ff       	call   80101c5e <iunlockput>
801060e1:	83 c4 10             	add    $0x10,%esp
  end_op();
801060e4:	e8 02 d5 ff ff       	call   801035eb <end_op>
  return 0;
801060e9:	b8 00 00 00 00       	mov    $0x0,%eax
}
801060ee:	c9                   	leave  
801060ef:	c3                   	ret    

801060f0 <sys_mknod>:

int
sys_mknod(void)
{
801060f0:	55                   	push   %ebp
801060f1:	89 e5                	mov    %esp,%ebp
801060f3:	83 ec 18             	sub    $0x18,%esp
  struct inode *ip;
  char *path;
  int major, minor;

  begin_op();
801060f6:	e8 64 d4 ff ff       	call   8010355f <begin_op>
  if((argstr(0, &path)) < 0 ||
801060fb:	83 ec 08             	sub    $0x8,%esp
801060fe:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106101:	50                   	push   %eax
80106102:	6a 00                	push   $0x0
80106104:	e8 e7 f4 ff ff       	call   801055f0 <argstr>
80106109:	83 c4 10             	add    $0x10,%esp
8010610c:	85 c0                	test   %eax,%eax
8010610e:	78 4f                	js     8010615f <sys_mknod+0x6f>
     argint(1, &major) < 0 ||
80106110:	83 ec 08             	sub    $0x8,%esp
80106113:	8d 45 ec             	lea    -0x14(%ebp),%eax
80106116:	50                   	push   %eax
80106117:	6a 01                	push   $0x1
80106119:	e8 3d f4 ff ff       	call   8010555b <argint>
8010611e:	83 c4 10             	add    $0x10,%esp
  if((argstr(0, &path)) < 0 ||
80106121:	85 c0                	test   %eax,%eax
80106123:	78 3a                	js     8010615f <sys_mknod+0x6f>
     argint(2, &minor) < 0 ||
80106125:	83 ec 08             	sub    $0x8,%esp
80106128:	8d 45 e8             	lea    -0x18(%ebp),%eax
8010612b:	50                   	push   %eax
8010612c:	6a 02                	push   $0x2
8010612e:	e8 28 f4 ff ff       	call   8010555b <argint>
80106133:	83 c4 10             	add    $0x10,%esp
     argint(1, &major) < 0 ||
80106136:	85 c0                	test   %eax,%eax
80106138:	78 25                	js     8010615f <sys_mknod+0x6f>
     (ip = create(path, T_DEV, major, minor)) == 0){
8010613a:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010613d:	0f bf c8             	movswl %ax,%ecx
80106140:	8b 45 ec             	mov    -0x14(%ebp),%eax
80106143:	0f bf d0             	movswl %ax,%edx
80106146:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106149:	51                   	push   %ecx
8010614a:	52                   	push   %edx
8010614b:	6a 03                	push   $0x3
8010614d:	50                   	push   %eax
8010614e:	e8 cd fb ff ff       	call   80105d20 <create>
80106153:	83 c4 10             	add    $0x10,%esp
80106156:	89 45 f4             	mov    %eax,-0xc(%ebp)
     argint(2, &minor) < 0 ||
80106159:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010615d:	75 0c                	jne    8010616b <sys_mknod+0x7b>
    end_op();
8010615f:	e8 87 d4 ff ff       	call   801035eb <end_op>
    return -1;
80106164:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106169:	eb 18                	jmp    80106183 <sys_mknod+0x93>
  }
  iunlockput(ip);
8010616b:	83 ec 0c             	sub    $0xc,%esp
8010616e:	ff 75 f4             	push   -0xc(%ebp)
80106171:	e8 e8 ba ff ff       	call   80101c5e <iunlockput>
80106176:	83 c4 10             	add    $0x10,%esp
  end_op();
80106179:	e8 6d d4 ff ff       	call   801035eb <end_op>
  return 0;
8010617e:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106183:	c9                   	leave  
80106184:	c3                   	ret    

80106185 <sys_chdir>:

int
sys_chdir(void)
{
80106185:	55                   	push   %ebp
80106186:	89 e5                	mov    %esp,%ebp
80106188:	83 ec 18             	sub    $0x18,%esp
  char *path;
  struct inode *ip;
  struct proc *curproc = myproc();
8010618b:	e8 4c e1 ff ff       	call   801042dc <myproc>
80106190:	89 45 f4             	mov    %eax,-0xc(%ebp)
  
  begin_op();
80106193:	e8 c7 d3 ff ff       	call   8010355f <begin_op>
  if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
80106198:	83 ec 08             	sub    $0x8,%esp
8010619b:	8d 45 ec             	lea    -0x14(%ebp),%eax
8010619e:	50                   	push   %eax
8010619f:	6a 00                	push   $0x0
801061a1:	e8 4a f4 ff ff       	call   801055f0 <argstr>
801061a6:	83 c4 10             	add    $0x10,%esp
801061a9:	85 c0                	test   %eax,%eax
801061ab:	78 18                	js     801061c5 <sys_chdir+0x40>
801061ad:	8b 45 ec             	mov    -0x14(%ebp),%eax
801061b0:	83 ec 0c             	sub    $0xc,%esp
801061b3:	50                   	push   %eax
801061b4:	e8 a7 c3 ff ff       	call   80102560 <namei>
801061b9:	83 c4 10             	add    $0x10,%esp
801061bc:	89 45 f0             	mov    %eax,-0x10(%ebp)
801061bf:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801061c3:	75 0c                	jne    801061d1 <sys_chdir+0x4c>
    end_op();
801061c5:	e8 21 d4 ff ff       	call   801035eb <end_op>
    return -1;
801061ca:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801061cf:	eb 68                	jmp    80106239 <sys_chdir+0xb4>
  }
  ilock(ip);
801061d1:	83 ec 0c             	sub    $0xc,%esp
801061d4:	ff 75 f0             	push   -0x10(%ebp)
801061d7:	e8 51 b8 ff ff       	call   80101a2d <ilock>
801061dc:	83 c4 10             	add    $0x10,%esp
  if(ip->type != T_DIR){
801061df:	8b 45 f0             	mov    -0x10(%ebp),%eax
801061e2:	0f b7 40 50          	movzwl 0x50(%eax),%eax
801061e6:	66 83 f8 01          	cmp    $0x1,%ax
801061ea:	74 1a                	je     80106206 <sys_chdir+0x81>
    iunlockput(ip);
801061ec:	83 ec 0c             	sub    $0xc,%esp
801061ef:	ff 75 f0             	push   -0x10(%ebp)
801061f2:	e8 67 ba ff ff       	call   80101c5e <iunlockput>
801061f7:	83 c4 10             	add    $0x10,%esp
    end_op();
801061fa:	e8 ec d3 ff ff       	call   801035eb <end_op>
    return -1;
801061ff:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106204:	eb 33                	jmp    80106239 <sys_chdir+0xb4>
  }
  iunlock(ip);
80106206:	83 ec 0c             	sub    $0xc,%esp
80106209:	ff 75 f0             	push   -0x10(%ebp)
8010620c:	e8 2f b9 ff ff       	call   80101b40 <iunlock>
80106211:	83 c4 10             	add    $0x10,%esp
  iput(curproc->cwd);
80106214:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106217:	8b 40 68             	mov    0x68(%eax),%eax
8010621a:	83 ec 0c             	sub    $0xc,%esp
8010621d:	50                   	push   %eax
8010621e:	e8 6b b9 ff ff       	call   80101b8e <iput>
80106223:	83 c4 10             	add    $0x10,%esp
  end_op();
80106226:	e8 c0 d3 ff ff       	call   801035eb <end_op>
  curproc->cwd = ip;
8010622b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010622e:	8b 55 f0             	mov    -0x10(%ebp),%edx
80106231:	89 50 68             	mov    %edx,0x68(%eax)
  return 0;
80106234:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106239:	c9                   	leave  
8010623a:	c3                   	ret    

8010623b <sys_exec>:

int
sys_exec(void)
{
8010623b:	55                   	push   %ebp
8010623c:	89 e5                	mov    %esp,%ebp
8010623e:	81 ec 98 00 00 00    	sub    $0x98,%esp
  char *path, *argv[MAXARG];
  int i;
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
80106244:	83 ec 08             	sub    $0x8,%esp
80106247:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010624a:	50                   	push   %eax
8010624b:	6a 00                	push   $0x0
8010624d:	e8 9e f3 ff ff       	call   801055f0 <argstr>
80106252:	83 c4 10             	add    $0x10,%esp
80106255:	85 c0                	test   %eax,%eax
80106257:	78 18                	js     80106271 <sys_exec+0x36>
80106259:	83 ec 08             	sub    $0x8,%esp
8010625c:	8d 85 6c ff ff ff    	lea    -0x94(%ebp),%eax
80106262:	50                   	push   %eax
80106263:	6a 01                	push   $0x1
80106265:	e8 f1 f2 ff ff       	call   8010555b <argint>
8010626a:	83 c4 10             	add    $0x10,%esp
8010626d:	85 c0                	test   %eax,%eax
8010626f:	79 0a                	jns    8010627b <sys_exec+0x40>
    return -1;
80106271:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106276:	e9 c6 00 00 00       	jmp    80106341 <sys_exec+0x106>
  }
  memset(argv, 0, sizeof(argv));
8010627b:	83 ec 04             	sub    $0x4,%esp
8010627e:	68 80 00 00 00       	push   $0x80
80106283:	6a 00                	push   $0x0
80106285:	8d 85 70 ff ff ff    	lea    -0x90(%ebp),%eax
8010628b:	50                   	push   %eax
8010628c:	e8 9f ef ff ff       	call   80105230 <memset>
80106291:	83 c4 10             	add    $0x10,%esp
  for(i=0;; i++){
80106294:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if(i >= NELEM(argv))
8010629b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010629e:	83 f8 1f             	cmp    $0x1f,%eax
801062a1:	76 0a                	jbe    801062ad <sys_exec+0x72>
      return -1;
801062a3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801062a8:	e9 94 00 00 00       	jmp    80106341 <sys_exec+0x106>
    if(fetchint(uargv+4*i, (int*)&uarg) < 0)
801062ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801062b0:	c1 e0 02             	shl    $0x2,%eax
801062b3:	89 c2                	mov    %eax,%edx
801062b5:	8b 85 6c ff ff ff    	mov    -0x94(%ebp),%eax
801062bb:	01 c2                	add    %eax,%edx
801062bd:	83 ec 08             	sub    $0x8,%esp
801062c0:	8d 85 68 ff ff ff    	lea    -0x98(%ebp),%eax
801062c6:	50                   	push   %eax
801062c7:	52                   	push   %edx
801062c8:	e8 ed f1 ff ff       	call   801054ba <fetchint>
801062cd:	83 c4 10             	add    $0x10,%esp
801062d0:	85 c0                	test   %eax,%eax
801062d2:	79 07                	jns    801062db <sys_exec+0xa0>
      return -1;
801062d4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801062d9:	eb 66                	jmp    80106341 <sys_exec+0x106>
    if(uarg == 0){
801062db:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
801062e1:	85 c0                	test   %eax,%eax
801062e3:	75 27                	jne    8010630c <sys_exec+0xd1>
      argv[i] = 0;
801062e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801062e8:	c7 84 85 70 ff ff ff 	movl   $0x0,-0x90(%ebp,%eax,4)
801062ef:	00 00 00 00 
      break;
801062f3:	90                   	nop
    }
    if(fetchstr(uarg, &argv[i]) < 0)
      return -1;
  }
  return exec(path, argv);
801062f4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801062f7:	83 ec 08             	sub    $0x8,%esp
801062fa:	8d 95 70 ff ff ff    	lea    -0x90(%ebp),%edx
80106300:	52                   	push   %edx
80106301:	50                   	push   %eax
80106302:	e8 bc a8 ff ff       	call   80100bc3 <exec>
80106307:	83 c4 10             	add    $0x10,%esp
8010630a:	eb 35                	jmp    80106341 <sys_exec+0x106>
    if(fetchstr(uarg, &argv[i]) < 0)
8010630c:	8d 95 70 ff ff ff    	lea    -0x90(%ebp),%edx
80106312:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106315:	c1 e0 02             	shl    $0x2,%eax
80106318:	01 c2                	add    %eax,%edx
8010631a:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
80106320:	83 ec 08             	sub    $0x8,%esp
80106323:	52                   	push   %edx
80106324:	50                   	push   %eax
80106325:	e8 cf f1 ff ff       	call   801054f9 <fetchstr>
8010632a:	83 c4 10             	add    $0x10,%esp
8010632d:	85 c0                	test   %eax,%eax
8010632f:	79 07                	jns    80106338 <sys_exec+0xfd>
      return -1;
80106331:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106336:	eb 09                	jmp    80106341 <sys_exec+0x106>
  for(i=0;; i++){
80106338:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
    if(i >= NELEM(argv))
8010633c:	e9 5a ff ff ff       	jmp    8010629b <sys_exec+0x60>
}
80106341:	c9                   	leave  
80106342:	c3                   	ret    

80106343 <sys_pipe>:

int
sys_pipe(void)
{
80106343:	55                   	push   %ebp
80106344:	89 e5                	mov    %esp,%ebp
80106346:	83 ec 28             	sub    $0x28,%esp
  int *fd;
  struct file *rf, *wf;
  int fd0, fd1;

  if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
80106349:	83 ec 04             	sub    $0x4,%esp
8010634c:	6a 08                	push   $0x8
8010634e:	8d 45 ec             	lea    -0x14(%ebp),%eax
80106351:	50                   	push   %eax
80106352:	6a 00                	push   $0x0
80106354:	e8 2f f2 ff ff       	call   80105588 <argptr>
80106359:	83 c4 10             	add    $0x10,%esp
8010635c:	85 c0                	test   %eax,%eax
8010635e:	79 0a                	jns    8010636a <sys_pipe+0x27>
    return -1;
80106360:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106365:	e9 ae 00 00 00       	jmp    80106418 <sys_pipe+0xd5>
  if(pipealloc(&rf, &wf) < 0)
8010636a:	83 ec 08             	sub    $0x8,%esp
8010636d:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80106370:	50                   	push   %eax
80106371:	8d 45 e8             	lea    -0x18(%ebp),%eax
80106374:	50                   	push   %eax
80106375:	e8 9f da ff ff       	call   80103e19 <pipealloc>
8010637a:	83 c4 10             	add    $0x10,%esp
8010637d:	85 c0                	test   %eax,%eax
8010637f:	79 0a                	jns    8010638b <sys_pipe+0x48>
    return -1;
80106381:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106386:	e9 8d 00 00 00       	jmp    80106418 <sys_pipe+0xd5>
  fd0 = -1;
8010638b:	c7 45 f4 ff ff ff ff 	movl   $0xffffffff,-0xc(%ebp)
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80106392:	8b 45 e8             	mov    -0x18(%ebp),%eax
80106395:	83 ec 0c             	sub    $0xc,%esp
80106398:	50                   	push   %eax
80106399:	e8 7b f3 ff ff       	call   80105719 <fdalloc>
8010639e:	83 c4 10             	add    $0x10,%esp
801063a1:	89 45 f4             	mov    %eax,-0xc(%ebp)
801063a4:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801063a8:	78 18                	js     801063c2 <sys_pipe+0x7f>
801063aa:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801063ad:	83 ec 0c             	sub    $0xc,%esp
801063b0:	50                   	push   %eax
801063b1:	e8 63 f3 ff ff       	call   80105719 <fdalloc>
801063b6:	83 c4 10             	add    $0x10,%esp
801063b9:	89 45 f0             	mov    %eax,-0x10(%ebp)
801063bc:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801063c0:	79 3e                	jns    80106400 <sys_pipe+0xbd>
    if(fd0 >= 0)
801063c2:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801063c6:	78 13                	js     801063db <sys_pipe+0x98>
      myproc()->ofile[fd0] = 0;
801063c8:	e8 0f df ff ff       	call   801042dc <myproc>
801063cd:	8b 55 f4             	mov    -0xc(%ebp),%edx
801063d0:	83 c2 08             	add    $0x8,%edx
801063d3:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
801063da:	00 
    fileclose(rf);
801063db:	8b 45 e8             	mov    -0x18(%ebp),%eax
801063de:	83 ec 0c             	sub    $0xc,%esp
801063e1:	50                   	push   %eax
801063e2:	e8 f7 ac ff ff       	call   801010de <fileclose>
801063e7:	83 c4 10             	add    $0x10,%esp
    fileclose(wf);
801063ea:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801063ed:	83 ec 0c             	sub    $0xc,%esp
801063f0:	50                   	push   %eax
801063f1:	e8 e8 ac ff ff       	call   801010de <fileclose>
801063f6:	83 c4 10             	add    $0x10,%esp
    return -1;
801063f9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801063fe:	eb 18                	jmp    80106418 <sys_pipe+0xd5>
  }
  fd[0] = fd0;
80106400:	8b 45 ec             	mov    -0x14(%ebp),%eax
80106403:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106406:	89 10                	mov    %edx,(%eax)
  fd[1] = fd1;
80106408:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010640b:	8d 50 04             	lea    0x4(%eax),%edx
8010640e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106411:	89 02                	mov    %eax,(%edx)
  return 0;
80106413:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106418:	c9                   	leave  
80106419:	c3                   	ret    

8010641a <outw>:
{
8010641a:	55                   	push   %ebp
8010641b:	89 e5                	mov    %esp,%ebp
8010641d:	83 ec 08             	sub    $0x8,%esp
80106420:	8b 55 08             	mov    0x8(%ebp),%edx
80106423:	8b 45 0c             	mov    0xc(%ebp),%eax
80106426:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
8010642a:	66 89 45 f8          	mov    %ax,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010642e:	0f b7 45 f8          	movzwl -0x8(%ebp),%eax
80106432:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80106436:	66 ef                	out    %ax,(%dx)
}
80106438:	90                   	nop
80106439:	c9                   	leave  
8010643a:	c3                   	ret    

8010643b <sys_fork>:
#include "mmu.h"
#include "proc.h"

int
sys_fork(void)
{
8010643b:	55                   	push   %ebp
8010643c:	89 e5                	mov    %esp,%ebp
8010643e:	83 ec 08             	sub    $0x8,%esp
  return fork();
80106441:	e8 95 e1 ff ff       	call   801045db <fork>
}
80106446:	c9                   	leave  
80106447:	c3                   	ret    

80106448 <sys_exit>:

int
sys_exit(void)
{
80106448:	55                   	push   %ebp
80106449:	89 e5                	mov    %esp,%ebp
8010644b:	83 ec 08             	sub    $0x8,%esp
  exit();
8010644e:	e8 1b e3 ff ff       	call   8010476e <exit>
  return 0;  // not reached
80106453:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106458:	c9                   	leave  
80106459:	c3                   	ret    

8010645a <sys_wait>:

int
sys_wait(void)
{
8010645a:	55                   	push   %ebp
8010645b:	89 e5                	mov    %esp,%ebp
8010645d:	83 ec 08             	sub    $0x8,%esp
  return wait();
80106460:	e8 29 e4 ff ff       	call   8010488e <wait>
}
80106465:	c9                   	leave  
80106466:	c3                   	ret    

80106467 <sys_kill>:

int
sys_kill(void)
{
80106467:	55                   	push   %ebp
80106468:	89 e5                	mov    %esp,%ebp
8010646a:	83 ec 18             	sub    $0x18,%esp
  int pid;

  if(argint(0, &pid) < 0)
8010646d:	83 ec 08             	sub    $0x8,%esp
80106470:	8d 45 f4             	lea    -0xc(%ebp),%eax
80106473:	50                   	push   %eax
80106474:	6a 00                	push   $0x0
80106476:	e8 e0 f0 ff ff       	call   8010555b <argint>
8010647b:	83 c4 10             	add    $0x10,%esp
8010647e:	85 c0                	test   %eax,%eax
80106480:	79 07                	jns    80106489 <sys_kill+0x22>
    return -1;
80106482:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106487:	eb 0f                	jmp    80106498 <sys_kill+0x31>
  return kill(pid);
80106489:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010648c:	83 ec 0c             	sub    $0xc,%esp
8010648f:	50                   	push   %eax
80106490:	e8 28 e8 ff ff       	call   80104cbd <kill>
80106495:	83 c4 10             	add    $0x10,%esp
}
80106498:	c9                   	leave  
80106499:	c3                   	ret    

8010649a <sys_getpid>:

int
sys_getpid(void)
{
8010649a:	55                   	push   %ebp
8010649b:	89 e5                	mov    %esp,%ebp
8010649d:	83 ec 08             	sub    $0x8,%esp
  return myproc()->pid;
801064a0:	e8 37 de ff ff       	call   801042dc <myproc>
801064a5:	8b 40 10             	mov    0x10(%eax),%eax
}
801064a8:	c9                   	leave  
801064a9:	c3                   	ret    

801064aa <sys_sbrk>:

int
sys_sbrk(void)
{
801064aa:	55                   	push   %ebp
801064ab:	89 e5                	mov    %esp,%ebp
801064ad:	83 ec 18             	sub    $0x18,%esp
  int n;
  uint sz;
  struct proc *curproc = myproc();
801064b0:	e8 27 de ff ff       	call   801042dc <myproc>
801064b5:	89 45 f4             	mov    %eax,-0xc(%ebp)

  sz = curproc->sz;
801064b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801064bb:	8b 00                	mov    (%eax),%eax
801064bd:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(argint(0, &n) < 0)
801064c0:	83 ec 08             	sub    $0x8,%esp
801064c3:	8d 45 ec             	lea    -0x14(%ebp),%eax
801064c6:	50                   	push   %eax
801064c7:	6a 00                	push   $0x0
801064c9:	e8 8d f0 ff ff       	call   8010555b <argint>
801064ce:	83 c4 10             	add    $0x10,%esp
801064d1:	85 c0                	test   %eax,%eax
801064d3:	79 07                	jns    801064dc <sys_sbrk+0x32>
    return -1;
801064d5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801064da:	eb 48                	jmp    80106524 <sys_sbrk+0x7a>

  if(n < 0){
801064dc:	8b 45 ec             	mov    -0x14(%ebp),%eax
801064df:	85 c0                	test   %eax,%eax
801064e1:	79 1a                	jns    801064fd <sys_sbrk+0x53>
    // free memory now
    if(growproc(n) < 0)
801064e3:	8b 45 ec             	mov    -0x14(%ebp),%eax
801064e6:	83 ec 0c             	sub    $0xc,%esp
801064e9:	50                   	push   %eax
801064ea:	e8 51 e0 ff ff       	call   80104540 <growproc>
801064ef:	83 c4 10             	add    $0x10,%esp
801064f2:	85 c0                	test   %eax,%eax
801064f4:	79 1c                	jns    80106512 <sys_sbrk+0x68>
    return -1;
801064f6:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801064fb:	eb 27                	jmp    80106524 <sys_sbrk+0x7a>

  }else if(n + sz >= KERNBASE){
801064fd:	8b 45 ec             	mov    -0x14(%ebp),%eax
80106500:	89 c2                	mov    %eax,%edx
80106502:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106505:	01 d0                	add    %edx,%eax
80106507:	85 c0                	test   %eax,%eax
80106509:	79 07                	jns    80106512 <sys_sbrk+0x68>
    // too large
    return -1;
8010650b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106510:	eb 12                	jmp    80106524 <sys_sbrk+0x7a>
  }
  // 需要修改myproc->sz 表示进程的占用内存
  curproc->sz = n + sz;
80106512:	8b 45 ec             	mov    -0x14(%ebp),%eax
80106515:	89 c2                	mov    %eax,%edx
80106517:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010651a:	01 c2                	add    %eax,%edx
8010651c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010651f:	89 10                	mov    %edx,(%eax)
  return sz;
80106521:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80106524:	c9                   	leave  
80106525:	c3                   	ret    

80106526 <sys_sleep>:

int
sys_sleep(void)
{
80106526:	55                   	push   %ebp
80106527:	89 e5                	mov    %esp,%ebp
80106529:	83 ec 18             	sub    $0x18,%esp
  int n;
  uint ticks0;

  if(argint(0, &n) < 0)
8010652c:	83 ec 08             	sub    $0x8,%esp
8010652f:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106532:	50                   	push   %eax
80106533:	6a 00                	push   $0x0
80106535:	e8 21 f0 ff ff       	call   8010555b <argint>
8010653a:	83 c4 10             	add    $0x10,%esp
8010653d:	85 c0                	test   %eax,%eax
8010653f:	79 07                	jns    80106548 <sys_sleep+0x22>
    return -1;
80106541:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106546:	eb 76                	jmp    801065be <sys_sleep+0x98>
  acquire(&tickslock);
80106548:	83 ec 0c             	sub    $0xc,%esp
8010654b:	68 c0 54 11 80       	push   $0x801154c0
80106550:	e8 65 ea ff ff       	call   80104fba <acquire>
80106555:	83 c4 10             	add    $0x10,%esp
  ticks0 = ticks;
80106558:	a1 f4 54 11 80       	mov    0x801154f4,%eax
8010655d:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(ticks - ticks0 < n){
80106560:	eb 38                	jmp    8010659a <sys_sleep+0x74>
    if(myproc()->killed){
80106562:	e8 75 dd ff ff       	call   801042dc <myproc>
80106567:	8b 40 24             	mov    0x24(%eax),%eax
8010656a:	85 c0                	test   %eax,%eax
8010656c:	74 17                	je     80106585 <sys_sleep+0x5f>
      release(&tickslock);
8010656e:	83 ec 0c             	sub    $0xc,%esp
80106571:	68 c0 54 11 80       	push   $0x801154c0
80106576:	e8 ad ea ff ff       	call   80105028 <release>
8010657b:	83 c4 10             	add    $0x10,%esp
      return -1;
8010657e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106583:	eb 39                	jmp    801065be <sys_sleep+0x98>
    }
    sleep(&ticks, &tickslock);
80106585:	83 ec 08             	sub    $0x8,%esp
80106588:	68 c0 54 11 80       	push   $0x801154c0
8010658d:	68 f4 54 11 80       	push   $0x801154f4
80106592:	e8 08 e6 ff ff       	call   80104b9f <sleep>
80106597:	83 c4 10             	add    $0x10,%esp
  while(ticks - ticks0 < n){
8010659a:	a1 f4 54 11 80       	mov    0x801154f4,%eax
8010659f:	2b 45 f4             	sub    -0xc(%ebp),%eax
801065a2:	8b 55 f0             	mov    -0x10(%ebp),%edx
801065a5:	39 d0                	cmp    %edx,%eax
801065a7:	72 b9                	jb     80106562 <sys_sleep+0x3c>
  }
  release(&tickslock);
801065a9:	83 ec 0c             	sub    $0xc,%esp
801065ac:	68 c0 54 11 80       	push   $0x801154c0
801065b1:	e8 72 ea ff ff       	call   80105028 <release>
801065b6:	83 c4 10             	add    $0x10,%esp
  return 0;
801065b9:	b8 00 00 00 00       	mov    $0x0,%eax
}
801065be:	c9                   	leave  
801065bf:	c3                   	ret    

801065c0 <sys_uptime>:

// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
801065c0:	55                   	push   %ebp
801065c1:	89 e5                	mov    %esp,%ebp
801065c3:	83 ec 18             	sub    $0x18,%esp
  uint xticks;

  acquire(&tickslock);
801065c6:	83 ec 0c             	sub    $0xc,%esp
801065c9:	68 c0 54 11 80       	push   $0x801154c0
801065ce:	e8 e7 e9 ff ff       	call   80104fba <acquire>
801065d3:	83 c4 10             	add    $0x10,%esp
  xticks = ticks;
801065d6:	a1 f4 54 11 80       	mov    0x801154f4,%eax
801065db:	89 45 f4             	mov    %eax,-0xc(%ebp)
  release(&tickslock);
801065de:	83 ec 0c             	sub    $0xc,%esp
801065e1:	68 c0 54 11 80       	push   $0x801154c0
801065e6:	e8 3d ea ff ff       	call   80105028 <release>
801065eb:	83 c4 10             	add    $0x10,%esp
  return xticks;
801065ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
801065f1:	c9                   	leave  
801065f2:	c3                   	ret    

801065f3 <sys_shutdown>:

int
sys_shutdown(void){
801065f3:	55                   	push   %ebp
801065f4:	89 e5                	mov    %esp,%ebp
  outw(0x604, 0x2000);
801065f6:	68 00 20 00 00       	push   $0x2000
801065fb:	68 04 06 00 00       	push   $0x604
80106600:	e8 15 fe ff ff       	call   8010641a <outw>
80106605:	83 c4 08             	add    $0x8,%esp
  return 0;
80106608:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010660d:	c9                   	leave  
8010660e:	c3                   	ret    

8010660f <sys_get_free_frame_cnt>:

extern int free_frame_cnt;
int
sys_get_free_frame_cnt(void){
8010660f:	55                   	push   %ebp
80106610:	89 e5                	mov    %esp,%ebp
  return free_frame_cnt;
80106612:	a1 80 26 11 80       	mov    0x80112680,%eax
80106617:	5d                   	pop    %ebp
80106618:	c3                   	ret    

80106619 <alltraps>:

  # vectors.S sends all traps here.
.globl alltraps
alltraps:
  # Build trap frame.
  pushl %ds
80106619:	1e                   	push   %ds
  pushl %es
8010661a:	06                   	push   %es
  pushl %fs
8010661b:	0f a0                	push   %fs
  pushl %gs
8010661d:	0f a8                	push   %gs
  pushal
8010661f:	60                   	pusha  
  
  # Set up data segments.
  movw $(SEG_KDATA<<3), %ax
80106620:	66 b8 10 00          	mov    $0x10,%ax
  movw %ax, %ds
80106624:	8e d8                	mov    %eax,%ds
  movw %ax, %es
80106626:	8e c0                	mov    %eax,%es

  # Call trap(tf), where tf=%esp
  pushl %esp
80106628:	54                   	push   %esp
  call trap
80106629:	e8 d7 01 00 00       	call   80106805 <trap>
  addl $4, %esp
8010662e:	83 c4 04             	add    $0x4,%esp

80106631 <trapret>:

  # Return falls through to trapret...
.globl trapret
trapret:
  popal
80106631:	61                   	popa   
  popl %gs
80106632:	0f a9                	pop    %gs
  popl %fs
80106634:	0f a1                	pop    %fs
  popl %es
80106636:	07                   	pop    %es
  popl %ds
80106637:	1f                   	pop    %ds
  addl $0x8, %esp  # trapno and errcode
80106638:	83 c4 08             	add    $0x8,%esp
  iret
8010663b:	cf                   	iret   

8010663c <lidt>:
{
8010663c:	55                   	push   %ebp
8010663d:	89 e5                	mov    %esp,%ebp
8010663f:	83 ec 10             	sub    $0x10,%esp
  pd[0] = size-1;
80106642:	8b 45 0c             	mov    0xc(%ebp),%eax
80106645:	83 e8 01             	sub    $0x1,%eax
80106648:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  pd[1] = (uint)p;
8010664c:	8b 45 08             	mov    0x8(%ebp),%eax
8010664f:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  pd[2] = (uint)p >> 16;
80106653:	8b 45 08             	mov    0x8(%ebp),%eax
80106656:	c1 e8 10             	shr    $0x10,%eax
80106659:	66 89 45 fe          	mov    %ax,-0x2(%ebp)
  asm volatile("lidt (%0)" : : "r" (pd));
8010665d:	8d 45 fa             	lea    -0x6(%ebp),%eax
80106660:	0f 01 18             	lidtl  (%eax)
}
80106663:	90                   	nop
80106664:	c9                   	leave  
80106665:	c3                   	ret    

80106666 <rcr2>:

static inline uint
rcr2(void)
{
80106666:	55                   	push   %ebp
80106667:	89 e5                	mov    %esp,%ebp
80106669:	83 ec 10             	sub    $0x10,%esp
  uint val;
  asm volatile("movl %%cr2,%0" : "=r" (val));
8010666c:	0f 20 d0             	mov    %cr2,%eax
8010666f:	89 45 fc             	mov    %eax,-0x4(%ebp)
  return val;
80106672:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80106675:	c9                   	leave  
80106676:	c3                   	ret    

80106677 <tvinit>:
struct spinlock tickslock;
uint ticks;

void
tvinit(void)
{
80106677:	55                   	push   %ebp
80106678:	89 e5                	mov    %esp,%ebp
8010667a:	83 ec 18             	sub    $0x18,%esp
  int i;

  for(i = 0; i < 256; i++)
8010667d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80106684:	e9 c3 00 00 00       	jmp    8010674c <tvinit+0xd5>
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
80106689:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010668c:	8b 04 85 80 b0 10 80 	mov    -0x7fef4f80(,%eax,4),%eax
80106693:	89 c2                	mov    %eax,%edx
80106695:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106698:	66 89 14 c5 c0 4c 11 	mov    %dx,-0x7feeb340(,%eax,8)
8010669f:	80 
801066a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066a3:	66 c7 04 c5 c2 4c 11 	movw   $0x8,-0x7feeb33e(,%eax,8)
801066aa:	80 08 00 
801066ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066b0:	0f b6 14 c5 c4 4c 11 	movzbl -0x7feeb33c(,%eax,8),%edx
801066b7:	80 
801066b8:	83 e2 e0             	and    $0xffffffe0,%edx
801066bb:	88 14 c5 c4 4c 11 80 	mov    %dl,-0x7feeb33c(,%eax,8)
801066c2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066c5:	0f b6 14 c5 c4 4c 11 	movzbl -0x7feeb33c(,%eax,8),%edx
801066cc:	80 
801066cd:	83 e2 1f             	and    $0x1f,%edx
801066d0:	88 14 c5 c4 4c 11 80 	mov    %dl,-0x7feeb33c(,%eax,8)
801066d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066da:	0f b6 14 c5 c5 4c 11 	movzbl -0x7feeb33b(,%eax,8),%edx
801066e1:	80 
801066e2:	83 e2 f0             	and    $0xfffffff0,%edx
801066e5:	83 ca 0e             	or     $0xe,%edx
801066e8:	88 14 c5 c5 4c 11 80 	mov    %dl,-0x7feeb33b(,%eax,8)
801066ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066f2:	0f b6 14 c5 c5 4c 11 	movzbl -0x7feeb33b(,%eax,8),%edx
801066f9:	80 
801066fa:	83 e2 ef             	and    $0xffffffef,%edx
801066fd:	88 14 c5 c5 4c 11 80 	mov    %dl,-0x7feeb33b(,%eax,8)
80106704:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106707:	0f b6 14 c5 c5 4c 11 	movzbl -0x7feeb33b(,%eax,8),%edx
8010670e:	80 
8010670f:	83 e2 9f             	and    $0xffffff9f,%edx
80106712:	88 14 c5 c5 4c 11 80 	mov    %dl,-0x7feeb33b(,%eax,8)
80106719:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010671c:	0f b6 14 c5 c5 4c 11 	movzbl -0x7feeb33b(,%eax,8),%edx
80106723:	80 
80106724:	83 ca 80             	or     $0xffffff80,%edx
80106727:	88 14 c5 c5 4c 11 80 	mov    %dl,-0x7feeb33b(,%eax,8)
8010672e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106731:	8b 04 85 80 b0 10 80 	mov    -0x7fef4f80(,%eax,4),%eax
80106738:	c1 e8 10             	shr    $0x10,%eax
8010673b:	89 c2                	mov    %eax,%edx
8010673d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106740:	66 89 14 c5 c6 4c 11 	mov    %dx,-0x7feeb33a(,%eax,8)
80106747:	80 
  for(i = 0; i < 256; i++)
80106748:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010674c:	81 7d f4 ff 00 00 00 	cmpl   $0xff,-0xc(%ebp)
80106753:	0f 8e 30 ff ff ff    	jle    80106689 <tvinit+0x12>
  SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
80106759:	a1 80 b1 10 80       	mov    0x8010b180,%eax
8010675e:	66 a3 c0 4e 11 80    	mov    %ax,0x80114ec0
80106764:	66 c7 05 c2 4e 11 80 	movw   $0x8,0x80114ec2
8010676b:	08 00 
8010676d:	0f b6 05 c4 4e 11 80 	movzbl 0x80114ec4,%eax
80106774:	83 e0 e0             	and    $0xffffffe0,%eax
80106777:	a2 c4 4e 11 80       	mov    %al,0x80114ec4
8010677c:	0f b6 05 c4 4e 11 80 	movzbl 0x80114ec4,%eax
80106783:	83 e0 1f             	and    $0x1f,%eax
80106786:	a2 c4 4e 11 80       	mov    %al,0x80114ec4
8010678b:	0f b6 05 c5 4e 11 80 	movzbl 0x80114ec5,%eax
80106792:	83 c8 0f             	or     $0xf,%eax
80106795:	a2 c5 4e 11 80       	mov    %al,0x80114ec5
8010679a:	0f b6 05 c5 4e 11 80 	movzbl 0x80114ec5,%eax
801067a1:	83 e0 ef             	and    $0xffffffef,%eax
801067a4:	a2 c5 4e 11 80       	mov    %al,0x80114ec5
801067a9:	0f b6 05 c5 4e 11 80 	movzbl 0x80114ec5,%eax
801067b0:	83 c8 60             	or     $0x60,%eax
801067b3:	a2 c5 4e 11 80       	mov    %al,0x80114ec5
801067b8:	0f b6 05 c5 4e 11 80 	movzbl 0x80114ec5,%eax
801067bf:	83 c8 80             	or     $0xffffff80,%eax
801067c2:	a2 c5 4e 11 80       	mov    %al,0x80114ec5
801067c7:	a1 80 b1 10 80       	mov    0x8010b180,%eax
801067cc:	c1 e8 10             	shr    $0x10,%eax
801067cf:	66 a3 c6 4e 11 80    	mov    %ax,0x80114ec6

  initlock(&tickslock, "time");
801067d5:	83 ec 08             	sub    $0x8,%esp
801067d8:	68 84 89 10 80       	push   $0x80108984
801067dd:	68 c0 54 11 80       	push   $0x801154c0
801067e2:	e8 b1 e7 ff ff       	call   80104f98 <initlock>
801067e7:	83 c4 10             	add    $0x10,%esp
}
801067ea:	90                   	nop
801067eb:	c9                   	leave  
801067ec:	c3                   	ret    

801067ed <idtinit>:

void
idtinit(void)
{
801067ed:	55                   	push   %ebp
801067ee:	89 e5                	mov    %esp,%ebp
  lidt(idt, sizeof(idt));
801067f0:	68 00 08 00 00       	push   $0x800
801067f5:	68 c0 4c 11 80       	push   $0x80114cc0
801067fa:	e8 3d fe ff ff       	call   8010663c <lidt>
801067ff:	83 c4 08             	add    $0x8,%esp
}
80106802:	90                   	nop
80106803:	c9                   	leave  
80106804:	c3                   	ret    

80106805 <trap>:
extern void pgflt_hdl(void);

//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80106805:	55                   	push   %ebp
80106806:	89 e5                	mov    %esp,%ebp
80106808:	57                   	push   %edi
80106809:	56                   	push   %esi
8010680a:	53                   	push   %ebx
8010680b:	83 ec 1c             	sub    $0x1c,%esp
  if(tf->trapno == T_SYSCALL){
8010680e:	8b 45 08             	mov    0x8(%ebp),%eax
80106811:	8b 40 30             	mov    0x30(%eax),%eax
80106814:	83 f8 40             	cmp    $0x40,%eax
80106817:	75 3b                	jne    80106854 <trap+0x4f>
    if(myproc()->killed)
80106819:	e8 be da ff ff       	call   801042dc <myproc>
8010681e:	8b 40 24             	mov    0x24(%eax),%eax
80106821:	85 c0                	test   %eax,%eax
80106823:	74 05                	je     8010682a <trap+0x25>
      exit();
80106825:	e8 44 df ff ff       	call   8010476e <exit>
    myproc()->tf = tf;
8010682a:	e8 ad da ff ff       	call   801042dc <myproc>
8010682f:	8b 55 08             	mov    0x8(%ebp),%edx
80106832:	89 50 18             	mov    %edx,0x18(%eax)
    syscall();
80106835:	e8 ed ed ff ff       	call   80105627 <syscall>
    if(myproc()->killed)
8010683a:	e8 9d da ff ff       	call   801042dc <myproc>
8010683f:	8b 40 24             	mov    0x24(%eax),%eax
80106842:	85 c0                	test   %eax,%eax
80106844:	0f 84 1b 02 00 00    	je     80106a65 <trap+0x260>
      exit();
8010684a:	e8 1f df ff ff       	call   8010476e <exit>
    return;
8010684f:	e9 11 02 00 00       	jmp    80106a65 <trap+0x260>
  }

  switch(tf->trapno){
80106854:	8b 45 08             	mov    0x8(%ebp),%eax
80106857:	8b 40 30             	mov    0x30(%eax),%eax
8010685a:	83 e8 0e             	sub    $0xe,%eax
8010685d:	83 f8 31             	cmp    $0x31,%eax
80106860:	0f 87 ca 00 00 00    	ja     80106930 <trap+0x12b>
80106866:	8b 04 85 2c 8a 10 80 	mov    -0x7fef75d4(,%eax,4),%eax
8010686d:	ff e0                	jmp    *%eax
  case T_IRQ0 + IRQ_TIMER:
    if(cpuid() == 0){
8010686f:	e8 d5 d9 ff ff       	call   80104249 <cpuid>
80106874:	85 c0                	test   %eax,%eax
80106876:	75 3d                	jne    801068b5 <trap+0xb0>
      acquire(&tickslock);
80106878:	83 ec 0c             	sub    $0xc,%esp
8010687b:	68 c0 54 11 80       	push   $0x801154c0
80106880:	e8 35 e7 ff ff       	call   80104fba <acquire>
80106885:	83 c4 10             	add    $0x10,%esp
      ticks++;
80106888:	a1 f4 54 11 80       	mov    0x801154f4,%eax
8010688d:	83 c0 01             	add    $0x1,%eax
80106890:	a3 f4 54 11 80       	mov    %eax,0x801154f4
      wakeup(&ticks);
80106895:	83 ec 0c             	sub    $0xc,%esp
80106898:	68 f4 54 11 80       	push   $0x801154f4
8010689d:	e8 e4 e3 ff ff       	call   80104c86 <wakeup>
801068a2:	83 c4 10             	add    $0x10,%esp
      release(&tickslock);
801068a5:	83 ec 0c             	sub    $0xc,%esp
801068a8:	68 c0 54 11 80       	push   $0x801154c0
801068ad:	e8 76 e7 ff ff       	call   80105028 <release>
801068b2:	83 c4 10             	add    $0x10,%esp
    }
    lapiceoi();
801068b5:	e8 85 c7 ff ff       	call   8010303f <lapiceoi>
    break;
801068ba:	e9 26 01 00 00       	jmp    801069e5 <trap+0x1e0>
  case T_IRQ0 + IRQ_IDE:
    ideintr();
801068bf:	e8 d5 bf ff ff       	call   80102899 <ideintr>
    lapiceoi();
801068c4:	e8 76 c7 ff ff       	call   8010303f <lapiceoi>
    break;
801068c9:	e9 17 01 00 00       	jmp    801069e5 <trap+0x1e0>
  case T_IRQ0 + IRQ_IDE+1:
    // Bochs generates spurious IDE1 interrupts.
    break;
  case T_IRQ0 + IRQ_KBD:
    kbdintr();
801068ce:	e8 b1 c5 ff ff       	call   80102e84 <kbdintr>
    lapiceoi();
801068d3:	e8 67 c7 ff ff       	call   8010303f <lapiceoi>
    break;
801068d8:	e9 08 01 00 00       	jmp    801069e5 <trap+0x1e0>
  case T_IRQ0 + IRQ_COM1:
    uartintr();
801068dd:	e8 59 03 00 00       	call   80106c3b <uartintr>
    lapiceoi();
801068e2:	e8 58 c7 ff ff       	call   8010303f <lapiceoi>
    break;
801068e7:	e9 f9 00 00 00       	jmp    801069e5 <trap+0x1e0>
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
801068ec:	8b 45 08             	mov    0x8(%ebp),%eax
801068ef:	8b 70 38             	mov    0x38(%eax),%esi
            cpuid(), tf->cs, tf->eip);
801068f2:	8b 45 08             	mov    0x8(%ebp),%eax
801068f5:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
801068f9:	0f b7 d8             	movzwl %ax,%ebx
801068fc:	e8 48 d9 ff ff       	call   80104249 <cpuid>
80106901:	56                   	push   %esi
80106902:	53                   	push   %ebx
80106903:	50                   	push   %eax
80106904:	68 8c 89 10 80       	push   $0x8010898c
80106909:	e8 f2 9a ff ff       	call   80100400 <cprintf>
8010690e:	83 c4 10             	add    $0x10,%esp
    lapiceoi();
80106911:	e8 29 c7 ff ff       	call   8010303f <lapiceoi>
    break;
80106916:	e9 ca 00 00 00       	jmp    801069e5 <trap+0x1e0>
  
  case T_PGFLT:
    myproc()->tf = tf;
8010691b:	e8 bc d9 ff ff       	call   801042dc <myproc>
80106920:	8b 55 08             	mov    0x8(%ebp),%edx
80106923:	89 50 18             	mov    %edx,0x18(%eax)
    pgflt_hdl();
80106926:	e8 b0 1a 00 00       	call   801083db <pgflt_hdl>
    break; // page fault handler
8010692b:	e9 b5 00 00 00       	jmp    801069e5 <trap+0x1e0>

  //PAGEBREAK: 13
  default:
    if(myproc() == 0 || (tf->cs&3) == 0){
80106930:	e8 a7 d9 ff ff       	call   801042dc <myproc>
80106935:	85 c0                	test   %eax,%eax
80106937:	74 11                	je     8010694a <trap+0x145>
80106939:	8b 45 08             	mov    0x8(%ebp),%eax
8010693c:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
80106940:	0f b7 c0             	movzwl %ax,%eax
80106943:	83 e0 03             	and    $0x3,%eax
80106946:	85 c0                	test   %eax,%eax
80106948:	75 39                	jne    80106983 <trap+0x17e>
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
8010694a:	e8 17 fd ff ff       	call   80106666 <rcr2>
8010694f:	89 c3                	mov    %eax,%ebx
80106951:	8b 45 08             	mov    0x8(%ebp),%eax
80106954:	8b 70 38             	mov    0x38(%eax),%esi
80106957:	e8 ed d8 ff ff       	call   80104249 <cpuid>
8010695c:	8b 55 08             	mov    0x8(%ebp),%edx
8010695f:	8b 52 30             	mov    0x30(%edx),%edx
80106962:	83 ec 0c             	sub    $0xc,%esp
80106965:	53                   	push   %ebx
80106966:	56                   	push   %esi
80106967:	50                   	push   %eax
80106968:	52                   	push   %edx
80106969:	68 b0 89 10 80       	push   $0x801089b0
8010696e:	e8 8d 9a ff ff       	call   80100400 <cprintf>
80106973:	83 c4 20             	add    $0x20,%esp
              tf->trapno, cpuid(), tf->eip, rcr2());
      panic("trap");
80106976:	83 ec 0c             	sub    $0xc,%esp
80106979:	68 e2 89 10 80       	push   $0x801089e2
8010697e:	e8 32 9c ff ff       	call   801005b5 <panic>
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106983:	e8 de fc ff ff       	call   80106666 <rcr2>
80106988:	89 c6                	mov    %eax,%esi
8010698a:	8b 45 08             	mov    0x8(%ebp),%eax
8010698d:	8b 40 38             	mov    0x38(%eax),%eax
80106990:	89 45 e4             	mov    %eax,-0x1c(%ebp)
80106993:	e8 b1 d8 ff ff       	call   80104249 <cpuid>
80106998:	89 c3                	mov    %eax,%ebx
8010699a:	8b 45 08             	mov    0x8(%ebp),%eax
8010699d:	8b 48 34             	mov    0x34(%eax),%ecx
801069a0:	89 4d e0             	mov    %ecx,-0x20(%ebp)
801069a3:	8b 45 08             	mov    0x8(%ebp),%eax
801069a6:	8b 78 30             	mov    0x30(%eax),%edi
            "eip 0x%x addr 0x%x--kill proc\n",
            myproc()->pid, myproc()->name, tf->trapno,
801069a9:	e8 2e d9 ff ff       	call   801042dc <myproc>
801069ae:	8d 50 6c             	lea    0x6c(%eax),%edx
801069b1:	89 55 dc             	mov    %edx,-0x24(%ebp)
801069b4:	e8 23 d9 ff ff       	call   801042dc <myproc>
    cprintf("pid %d %s: trap %d err %d on cpu %d "
801069b9:	8b 40 10             	mov    0x10(%eax),%eax
801069bc:	56                   	push   %esi
801069bd:	ff 75 e4             	push   -0x1c(%ebp)
801069c0:	53                   	push   %ebx
801069c1:	ff 75 e0             	push   -0x20(%ebp)
801069c4:	57                   	push   %edi
801069c5:	ff 75 dc             	push   -0x24(%ebp)
801069c8:	50                   	push   %eax
801069c9:	68 e8 89 10 80       	push   $0x801089e8
801069ce:	e8 2d 9a ff ff       	call   80100400 <cprintf>
801069d3:	83 c4 20             	add    $0x20,%esp
            tf->err, cpuid(), tf->eip, rcr2());
    myproc()->killed = 1;
801069d6:	e8 01 d9 ff ff       	call   801042dc <myproc>
801069db:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
801069e2:	eb 01                	jmp    801069e5 <trap+0x1e0>
    break;
801069e4:	90                   	nop
  }

  // Force process exit if it has been killed and is in user space.
  // (If it is still executing in the kernel, let it keep running
  // until it gets to the regular system call return.)
  if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
801069e5:	e8 f2 d8 ff ff       	call   801042dc <myproc>
801069ea:	85 c0                	test   %eax,%eax
801069ec:	74 23                	je     80106a11 <trap+0x20c>
801069ee:	e8 e9 d8 ff ff       	call   801042dc <myproc>
801069f3:	8b 40 24             	mov    0x24(%eax),%eax
801069f6:	85 c0                	test   %eax,%eax
801069f8:	74 17                	je     80106a11 <trap+0x20c>
801069fa:	8b 45 08             	mov    0x8(%ebp),%eax
801069fd:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
80106a01:	0f b7 c0             	movzwl %ax,%eax
80106a04:	83 e0 03             	and    $0x3,%eax
80106a07:	83 f8 03             	cmp    $0x3,%eax
80106a0a:	75 05                	jne    80106a11 <trap+0x20c>
    exit();
80106a0c:	e8 5d dd ff ff       	call   8010476e <exit>

  // Force process to give up CPU on clock tick.
  // If interrupts were on while locks held, would need to check nlock.
  if(myproc() && myproc()->state == RUNNING &&
80106a11:	e8 c6 d8 ff ff       	call   801042dc <myproc>
80106a16:	85 c0                	test   %eax,%eax
80106a18:	74 1d                	je     80106a37 <trap+0x232>
80106a1a:	e8 bd d8 ff ff       	call   801042dc <myproc>
80106a1f:	8b 40 0c             	mov    0xc(%eax),%eax
80106a22:	83 f8 04             	cmp    $0x4,%eax
80106a25:	75 10                	jne    80106a37 <trap+0x232>
     tf->trapno == T_IRQ0+IRQ_TIMER)
80106a27:	8b 45 08             	mov    0x8(%ebp),%eax
80106a2a:	8b 40 30             	mov    0x30(%eax),%eax
  if(myproc() && myproc()->state == RUNNING &&
80106a2d:	83 f8 20             	cmp    $0x20,%eax
80106a30:	75 05                	jne    80106a37 <trap+0x232>
    yield();
80106a32:	e8 e8 e0 ff ff       	call   80104b1f <yield>

  // Check if the process has been killed since we yielded
  if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
80106a37:	e8 a0 d8 ff ff       	call   801042dc <myproc>
80106a3c:	85 c0                	test   %eax,%eax
80106a3e:	74 26                	je     80106a66 <trap+0x261>
80106a40:	e8 97 d8 ff ff       	call   801042dc <myproc>
80106a45:	8b 40 24             	mov    0x24(%eax),%eax
80106a48:	85 c0                	test   %eax,%eax
80106a4a:	74 1a                	je     80106a66 <trap+0x261>
80106a4c:	8b 45 08             	mov    0x8(%ebp),%eax
80106a4f:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
80106a53:	0f b7 c0             	movzwl %ax,%eax
80106a56:	83 e0 03             	and    $0x3,%eax
80106a59:	83 f8 03             	cmp    $0x3,%eax
80106a5c:	75 08                	jne    80106a66 <trap+0x261>
    exit();
80106a5e:	e8 0b dd ff ff       	call   8010476e <exit>
80106a63:	eb 01                	jmp    80106a66 <trap+0x261>
    return;
80106a65:	90                   	nop
}
80106a66:	8d 65 f4             	lea    -0xc(%ebp),%esp
80106a69:	5b                   	pop    %ebx
80106a6a:	5e                   	pop    %esi
80106a6b:	5f                   	pop    %edi
80106a6c:	5d                   	pop    %ebp
80106a6d:	c3                   	ret    

80106a6e <inb>:
{
80106a6e:	55                   	push   %ebp
80106a6f:	89 e5                	mov    %esp,%ebp
80106a71:	83 ec 14             	sub    $0x14,%esp
80106a74:	8b 45 08             	mov    0x8(%ebp),%eax
80106a77:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80106a7b:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
80106a7f:	89 c2                	mov    %eax,%edx
80106a81:	ec                   	in     (%dx),%al
80106a82:	88 45 ff             	mov    %al,-0x1(%ebp)
  return data;
80106a85:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
}
80106a89:	c9                   	leave  
80106a8a:	c3                   	ret    

80106a8b <outb>:
{
80106a8b:	55                   	push   %ebp
80106a8c:	89 e5                	mov    %esp,%ebp
80106a8e:	83 ec 08             	sub    $0x8,%esp
80106a91:	8b 45 08             	mov    0x8(%ebp),%eax
80106a94:	8b 55 0c             	mov    0xc(%ebp),%edx
80106a97:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
80106a9b:	89 d0                	mov    %edx,%eax
80106a9d:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106aa0:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80106aa4:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80106aa8:	ee                   	out    %al,(%dx)
}
80106aa9:	90                   	nop
80106aaa:	c9                   	leave  
80106aab:	c3                   	ret    

80106aac <uartinit>:

static int uart;    // is there a uart?

void
uartinit(void)
{
80106aac:	55                   	push   %ebp
80106aad:	89 e5                	mov    %esp,%ebp
80106aaf:	83 ec 18             	sub    $0x18,%esp
  char *p;

  // Turn off the FIFO
  outb(COM1+2, 0);
80106ab2:	6a 00                	push   $0x0
80106ab4:	68 fa 03 00 00       	push   $0x3fa
80106ab9:	e8 cd ff ff ff       	call   80106a8b <outb>
80106abe:	83 c4 08             	add    $0x8,%esp

  // 9600 baud, 8 data bits, 1 stop bit, parity off.
  outb(COM1+3, 0x80);    // Unlock divisor
80106ac1:	68 80 00 00 00       	push   $0x80
80106ac6:	68 fb 03 00 00       	push   $0x3fb
80106acb:	e8 bb ff ff ff       	call   80106a8b <outb>
80106ad0:	83 c4 08             	add    $0x8,%esp
  outb(COM1+0, 115200/9600);
80106ad3:	6a 0c                	push   $0xc
80106ad5:	68 f8 03 00 00       	push   $0x3f8
80106ada:	e8 ac ff ff ff       	call   80106a8b <outb>
80106adf:	83 c4 08             	add    $0x8,%esp
  outb(COM1+1, 0);
80106ae2:	6a 00                	push   $0x0
80106ae4:	68 f9 03 00 00       	push   $0x3f9
80106ae9:	e8 9d ff ff ff       	call   80106a8b <outb>
80106aee:	83 c4 08             	add    $0x8,%esp
  outb(COM1+3, 0x03);    // Lock divisor, 8 data bits.
80106af1:	6a 03                	push   $0x3
80106af3:	68 fb 03 00 00       	push   $0x3fb
80106af8:	e8 8e ff ff ff       	call   80106a8b <outb>
80106afd:	83 c4 08             	add    $0x8,%esp
  outb(COM1+4, 0);
80106b00:	6a 00                	push   $0x0
80106b02:	68 fc 03 00 00       	push   $0x3fc
80106b07:	e8 7f ff ff ff       	call   80106a8b <outb>
80106b0c:	83 c4 08             	add    $0x8,%esp
  outb(COM1+1, 0x01);    // Enable receive interrupts.
80106b0f:	6a 01                	push   $0x1
80106b11:	68 f9 03 00 00       	push   $0x3f9
80106b16:	e8 70 ff ff ff       	call   80106a8b <outb>
80106b1b:	83 c4 08             	add    $0x8,%esp

  // If status is 0xFF, no serial port.
  if(inb(COM1+5) == 0xFF)
80106b1e:	68 fd 03 00 00       	push   $0x3fd
80106b23:	e8 46 ff ff ff       	call   80106a6e <inb>
80106b28:	83 c4 04             	add    $0x4,%esp
80106b2b:	3c ff                	cmp    $0xff,%al
80106b2d:	74 61                	je     80106b90 <uartinit+0xe4>
    return;
  uart = 1;
80106b2f:	c7 05 f8 54 11 80 01 	movl   $0x1,0x801154f8
80106b36:	00 00 00 

  // Acknowledge pre-existing interrupt conditions;
  // enable interrupts.
  inb(COM1+2);
80106b39:	68 fa 03 00 00       	push   $0x3fa
80106b3e:	e8 2b ff ff ff       	call   80106a6e <inb>
80106b43:	83 c4 04             	add    $0x4,%esp
  inb(COM1+0);
80106b46:	68 f8 03 00 00       	push   $0x3f8
80106b4b:	e8 1e ff ff ff       	call   80106a6e <inb>
80106b50:	83 c4 04             	add    $0x4,%esp
  ioapicenable(IRQ_COM1, 0);
80106b53:	83 ec 08             	sub    $0x8,%esp
80106b56:	6a 00                	push   $0x0
80106b58:	6a 04                	push   $0x4
80106b5a:	e8 d8 bf ff ff       	call   80102b37 <ioapicenable>
80106b5f:	83 c4 10             	add    $0x10,%esp

  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
80106b62:	c7 45 f4 f4 8a 10 80 	movl   $0x80108af4,-0xc(%ebp)
80106b69:	eb 19                	jmp    80106b84 <uartinit+0xd8>
    uartputc(*p);
80106b6b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106b6e:	0f b6 00             	movzbl (%eax),%eax
80106b71:	0f be c0             	movsbl %al,%eax
80106b74:	83 ec 0c             	sub    $0xc,%esp
80106b77:	50                   	push   %eax
80106b78:	e8 16 00 00 00       	call   80106b93 <uartputc>
80106b7d:	83 c4 10             	add    $0x10,%esp
  for(p="xv6...\n"; *p; p++)
80106b80:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80106b84:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106b87:	0f b6 00             	movzbl (%eax),%eax
80106b8a:	84 c0                	test   %al,%al
80106b8c:	75 dd                	jne    80106b6b <uartinit+0xbf>
80106b8e:	eb 01                	jmp    80106b91 <uartinit+0xe5>
    return;
80106b90:	90                   	nop
}
80106b91:	c9                   	leave  
80106b92:	c3                   	ret    

80106b93 <uartputc>:

void
uartputc(int c)
{
80106b93:	55                   	push   %ebp
80106b94:	89 e5                	mov    %esp,%ebp
80106b96:	83 ec 18             	sub    $0x18,%esp
  int i;

  if(!uart)
80106b99:	a1 f8 54 11 80       	mov    0x801154f8,%eax
80106b9e:	85 c0                	test   %eax,%eax
80106ba0:	74 53                	je     80106bf5 <uartputc+0x62>
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80106ba2:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80106ba9:	eb 11                	jmp    80106bbc <uartputc+0x29>
    microdelay(10);
80106bab:	83 ec 0c             	sub    $0xc,%esp
80106bae:	6a 0a                	push   $0xa
80106bb0:	e8 a5 c4 ff ff       	call   8010305a <microdelay>
80106bb5:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80106bb8:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80106bbc:	83 7d f4 7f          	cmpl   $0x7f,-0xc(%ebp)
80106bc0:	7f 1a                	jg     80106bdc <uartputc+0x49>
80106bc2:	83 ec 0c             	sub    $0xc,%esp
80106bc5:	68 fd 03 00 00       	push   $0x3fd
80106bca:	e8 9f fe ff ff       	call   80106a6e <inb>
80106bcf:	83 c4 10             	add    $0x10,%esp
80106bd2:	0f b6 c0             	movzbl %al,%eax
80106bd5:	83 e0 20             	and    $0x20,%eax
80106bd8:	85 c0                	test   %eax,%eax
80106bda:	74 cf                	je     80106bab <uartputc+0x18>
  outb(COM1+0, c);
80106bdc:	8b 45 08             	mov    0x8(%ebp),%eax
80106bdf:	0f b6 c0             	movzbl %al,%eax
80106be2:	83 ec 08             	sub    $0x8,%esp
80106be5:	50                   	push   %eax
80106be6:	68 f8 03 00 00       	push   $0x3f8
80106beb:	e8 9b fe ff ff       	call   80106a8b <outb>
80106bf0:	83 c4 10             	add    $0x10,%esp
80106bf3:	eb 01                	jmp    80106bf6 <uartputc+0x63>
    return;
80106bf5:	90                   	nop
}
80106bf6:	c9                   	leave  
80106bf7:	c3                   	ret    

80106bf8 <uartgetc>:

static int
uartgetc(void)
{
80106bf8:	55                   	push   %ebp
80106bf9:	89 e5                	mov    %esp,%ebp
  if(!uart)
80106bfb:	a1 f8 54 11 80       	mov    0x801154f8,%eax
80106c00:	85 c0                	test   %eax,%eax
80106c02:	75 07                	jne    80106c0b <uartgetc+0x13>
    return -1;
80106c04:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106c09:	eb 2e                	jmp    80106c39 <uartgetc+0x41>
  if(!(inb(COM1+5) & 0x01))
80106c0b:	68 fd 03 00 00       	push   $0x3fd
80106c10:	e8 59 fe ff ff       	call   80106a6e <inb>
80106c15:	83 c4 04             	add    $0x4,%esp
80106c18:	0f b6 c0             	movzbl %al,%eax
80106c1b:	83 e0 01             	and    $0x1,%eax
80106c1e:	85 c0                	test   %eax,%eax
80106c20:	75 07                	jne    80106c29 <uartgetc+0x31>
    return -1;
80106c22:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106c27:	eb 10                	jmp    80106c39 <uartgetc+0x41>
  return inb(COM1+0);
80106c29:	68 f8 03 00 00       	push   $0x3f8
80106c2e:	e8 3b fe ff ff       	call   80106a6e <inb>
80106c33:	83 c4 04             	add    $0x4,%esp
80106c36:	0f b6 c0             	movzbl %al,%eax
}
80106c39:	c9                   	leave  
80106c3a:	c3                   	ret    

80106c3b <uartintr>:

void
uartintr(void)
{
80106c3b:	55                   	push   %ebp
80106c3c:	89 e5                	mov    %esp,%ebp
80106c3e:	83 ec 08             	sub    $0x8,%esp
  consoleintr(uartgetc);
80106c41:	83 ec 0c             	sub    $0xc,%esp
80106c44:	68 f8 6b 10 80       	push   $0x80106bf8
80106c49:	e8 01 9c ff ff       	call   8010084f <consoleintr>
80106c4e:	83 c4 10             	add    $0x10,%esp
}
80106c51:	90                   	nop
80106c52:	c9                   	leave  
80106c53:	c3                   	ret    

80106c54 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
  pushl $0
80106c54:	6a 00                	push   $0x0
  pushl $0
80106c56:	6a 00                	push   $0x0
  jmp alltraps
80106c58:	e9 bc f9 ff ff       	jmp    80106619 <alltraps>

80106c5d <vector1>:
.globl vector1
vector1:
  pushl $0
80106c5d:	6a 00                	push   $0x0
  pushl $1
80106c5f:	6a 01                	push   $0x1
  jmp alltraps
80106c61:	e9 b3 f9 ff ff       	jmp    80106619 <alltraps>

80106c66 <vector2>:
.globl vector2
vector2:
  pushl $0
80106c66:	6a 00                	push   $0x0
  pushl $2
80106c68:	6a 02                	push   $0x2
  jmp alltraps
80106c6a:	e9 aa f9 ff ff       	jmp    80106619 <alltraps>

80106c6f <vector3>:
.globl vector3
vector3:
  pushl $0
80106c6f:	6a 00                	push   $0x0
  pushl $3
80106c71:	6a 03                	push   $0x3
  jmp alltraps
80106c73:	e9 a1 f9 ff ff       	jmp    80106619 <alltraps>

80106c78 <vector4>:
.globl vector4
vector4:
  pushl $0
80106c78:	6a 00                	push   $0x0
  pushl $4
80106c7a:	6a 04                	push   $0x4
  jmp alltraps
80106c7c:	e9 98 f9 ff ff       	jmp    80106619 <alltraps>

80106c81 <vector5>:
.globl vector5
vector5:
  pushl $0
80106c81:	6a 00                	push   $0x0
  pushl $5
80106c83:	6a 05                	push   $0x5
  jmp alltraps
80106c85:	e9 8f f9 ff ff       	jmp    80106619 <alltraps>

80106c8a <vector6>:
.globl vector6
vector6:
  pushl $0
80106c8a:	6a 00                	push   $0x0
  pushl $6
80106c8c:	6a 06                	push   $0x6
  jmp alltraps
80106c8e:	e9 86 f9 ff ff       	jmp    80106619 <alltraps>

80106c93 <vector7>:
.globl vector7
vector7:
  pushl $0
80106c93:	6a 00                	push   $0x0
  pushl $7
80106c95:	6a 07                	push   $0x7
  jmp alltraps
80106c97:	e9 7d f9 ff ff       	jmp    80106619 <alltraps>

80106c9c <vector8>:
.globl vector8
vector8:
  pushl $8
80106c9c:	6a 08                	push   $0x8
  jmp alltraps
80106c9e:	e9 76 f9 ff ff       	jmp    80106619 <alltraps>

80106ca3 <vector9>:
.globl vector9
vector9:
  pushl $0
80106ca3:	6a 00                	push   $0x0
  pushl $9
80106ca5:	6a 09                	push   $0x9
  jmp alltraps
80106ca7:	e9 6d f9 ff ff       	jmp    80106619 <alltraps>

80106cac <vector10>:
.globl vector10
vector10:
  pushl $10
80106cac:	6a 0a                	push   $0xa
  jmp alltraps
80106cae:	e9 66 f9 ff ff       	jmp    80106619 <alltraps>

80106cb3 <vector11>:
.globl vector11
vector11:
  pushl $11
80106cb3:	6a 0b                	push   $0xb
  jmp alltraps
80106cb5:	e9 5f f9 ff ff       	jmp    80106619 <alltraps>

80106cba <vector12>:
.globl vector12
vector12:
  pushl $12
80106cba:	6a 0c                	push   $0xc
  jmp alltraps
80106cbc:	e9 58 f9 ff ff       	jmp    80106619 <alltraps>

80106cc1 <vector13>:
.globl vector13
vector13:
  pushl $13
80106cc1:	6a 0d                	push   $0xd
  jmp alltraps
80106cc3:	e9 51 f9 ff ff       	jmp    80106619 <alltraps>

80106cc8 <vector14>:
.globl vector14
vector14:
  pushl $14
80106cc8:	6a 0e                	push   $0xe
  jmp alltraps
80106cca:	e9 4a f9 ff ff       	jmp    80106619 <alltraps>

80106ccf <vector15>:
.globl vector15
vector15:
  pushl $0
80106ccf:	6a 00                	push   $0x0
  pushl $15
80106cd1:	6a 0f                	push   $0xf
  jmp alltraps
80106cd3:	e9 41 f9 ff ff       	jmp    80106619 <alltraps>

80106cd8 <vector16>:
.globl vector16
vector16:
  pushl $0
80106cd8:	6a 00                	push   $0x0
  pushl $16
80106cda:	6a 10                	push   $0x10
  jmp alltraps
80106cdc:	e9 38 f9 ff ff       	jmp    80106619 <alltraps>

80106ce1 <vector17>:
.globl vector17
vector17:
  pushl $17
80106ce1:	6a 11                	push   $0x11
  jmp alltraps
80106ce3:	e9 31 f9 ff ff       	jmp    80106619 <alltraps>

80106ce8 <vector18>:
.globl vector18
vector18:
  pushl $0
80106ce8:	6a 00                	push   $0x0
  pushl $18
80106cea:	6a 12                	push   $0x12
  jmp alltraps
80106cec:	e9 28 f9 ff ff       	jmp    80106619 <alltraps>

80106cf1 <vector19>:
.globl vector19
vector19:
  pushl $0
80106cf1:	6a 00                	push   $0x0
  pushl $19
80106cf3:	6a 13                	push   $0x13
  jmp alltraps
80106cf5:	e9 1f f9 ff ff       	jmp    80106619 <alltraps>

80106cfa <vector20>:
.globl vector20
vector20:
  pushl $0
80106cfa:	6a 00                	push   $0x0
  pushl $20
80106cfc:	6a 14                	push   $0x14
  jmp alltraps
80106cfe:	e9 16 f9 ff ff       	jmp    80106619 <alltraps>

80106d03 <vector21>:
.globl vector21
vector21:
  pushl $0
80106d03:	6a 00                	push   $0x0
  pushl $21
80106d05:	6a 15                	push   $0x15
  jmp alltraps
80106d07:	e9 0d f9 ff ff       	jmp    80106619 <alltraps>

80106d0c <vector22>:
.globl vector22
vector22:
  pushl $0
80106d0c:	6a 00                	push   $0x0
  pushl $22
80106d0e:	6a 16                	push   $0x16
  jmp alltraps
80106d10:	e9 04 f9 ff ff       	jmp    80106619 <alltraps>

80106d15 <vector23>:
.globl vector23
vector23:
  pushl $0
80106d15:	6a 00                	push   $0x0
  pushl $23
80106d17:	6a 17                	push   $0x17
  jmp alltraps
80106d19:	e9 fb f8 ff ff       	jmp    80106619 <alltraps>

80106d1e <vector24>:
.globl vector24
vector24:
  pushl $0
80106d1e:	6a 00                	push   $0x0
  pushl $24
80106d20:	6a 18                	push   $0x18
  jmp alltraps
80106d22:	e9 f2 f8 ff ff       	jmp    80106619 <alltraps>

80106d27 <vector25>:
.globl vector25
vector25:
  pushl $0
80106d27:	6a 00                	push   $0x0
  pushl $25
80106d29:	6a 19                	push   $0x19
  jmp alltraps
80106d2b:	e9 e9 f8 ff ff       	jmp    80106619 <alltraps>

80106d30 <vector26>:
.globl vector26
vector26:
  pushl $0
80106d30:	6a 00                	push   $0x0
  pushl $26
80106d32:	6a 1a                	push   $0x1a
  jmp alltraps
80106d34:	e9 e0 f8 ff ff       	jmp    80106619 <alltraps>

80106d39 <vector27>:
.globl vector27
vector27:
  pushl $0
80106d39:	6a 00                	push   $0x0
  pushl $27
80106d3b:	6a 1b                	push   $0x1b
  jmp alltraps
80106d3d:	e9 d7 f8 ff ff       	jmp    80106619 <alltraps>

80106d42 <vector28>:
.globl vector28
vector28:
  pushl $0
80106d42:	6a 00                	push   $0x0
  pushl $28
80106d44:	6a 1c                	push   $0x1c
  jmp alltraps
80106d46:	e9 ce f8 ff ff       	jmp    80106619 <alltraps>

80106d4b <vector29>:
.globl vector29
vector29:
  pushl $0
80106d4b:	6a 00                	push   $0x0
  pushl $29
80106d4d:	6a 1d                	push   $0x1d
  jmp alltraps
80106d4f:	e9 c5 f8 ff ff       	jmp    80106619 <alltraps>

80106d54 <vector30>:
.globl vector30
vector30:
  pushl $0
80106d54:	6a 00                	push   $0x0
  pushl $30
80106d56:	6a 1e                	push   $0x1e
  jmp alltraps
80106d58:	e9 bc f8 ff ff       	jmp    80106619 <alltraps>

80106d5d <vector31>:
.globl vector31
vector31:
  pushl $0
80106d5d:	6a 00                	push   $0x0
  pushl $31
80106d5f:	6a 1f                	push   $0x1f
  jmp alltraps
80106d61:	e9 b3 f8 ff ff       	jmp    80106619 <alltraps>

80106d66 <vector32>:
.globl vector32
vector32:
  pushl $0
80106d66:	6a 00                	push   $0x0
  pushl $32
80106d68:	6a 20                	push   $0x20
  jmp alltraps
80106d6a:	e9 aa f8 ff ff       	jmp    80106619 <alltraps>

80106d6f <vector33>:
.globl vector33
vector33:
  pushl $0
80106d6f:	6a 00                	push   $0x0
  pushl $33
80106d71:	6a 21                	push   $0x21
  jmp alltraps
80106d73:	e9 a1 f8 ff ff       	jmp    80106619 <alltraps>

80106d78 <vector34>:
.globl vector34
vector34:
  pushl $0
80106d78:	6a 00                	push   $0x0
  pushl $34
80106d7a:	6a 22                	push   $0x22
  jmp alltraps
80106d7c:	e9 98 f8 ff ff       	jmp    80106619 <alltraps>

80106d81 <vector35>:
.globl vector35
vector35:
  pushl $0
80106d81:	6a 00                	push   $0x0
  pushl $35
80106d83:	6a 23                	push   $0x23
  jmp alltraps
80106d85:	e9 8f f8 ff ff       	jmp    80106619 <alltraps>

80106d8a <vector36>:
.globl vector36
vector36:
  pushl $0
80106d8a:	6a 00                	push   $0x0
  pushl $36
80106d8c:	6a 24                	push   $0x24
  jmp alltraps
80106d8e:	e9 86 f8 ff ff       	jmp    80106619 <alltraps>

80106d93 <vector37>:
.globl vector37
vector37:
  pushl $0
80106d93:	6a 00                	push   $0x0
  pushl $37
80106d95:	6a 25                	push   $0x25
  jmp alltraps
80106d97:	e9 7d f8 ff ff       	jmp    80106619 <alltraps>

80106d9c <vector38>:
.globl vector38
vector38:
  pushl $0
80106d9c:	6a 00                	push   $0x0
  pushl $38
80106d9e:	6a 26                	push   $0x26
  jmp alltraps
80106da0:	e9 74 f8 ff ff       	jmp    80106619 <alltraps>

80106da5 <vector39>:
.globl vector39
vector39:
  pushl $0
80106da5:	6a 00                	push   $0x0
  pushl $39
80106da7:	6a 27                	push   $0x27
  jmp alltraps
80106da9:	e9 6b f8 ff ff       	jmp    80106619 <alltraps>

80106dae <vector40>:
.globl vector40
vector40:
  pushl $0
80106dae:	6a 00                	push   $0x0
  pushl $40
80106db0:	6a 28                	push   $0x28
  jmp alltraps
80106db2:	e9 62 f8 ff ff       	jmp    80106619 <alltraps>

80106db7 <vector41>:
.globl vector41
vector41:
  pushl $0
80106db7:	6a 00                	push   $0x0
  pushl $41
80106db9:	6a 29                	push   $0x29
  jmp alltraps
80106dbb:	e9 59 f8 ff ff       	jmp    80106619 <alltraps>

80106dc0 <vector42>:
.globl vector42
vector42:
  pushl $0
80106dc0:	6a 00                	push   $0x0
  pushl $42
80106dc2:	6a 2a                	push   $0x2a
  jmp alltraps
80106dc4:	e9 50 f8 ff ff       	jmp    80106619 <alltraps>

80106dc9 <vector43>:
.globl vector43
vector43:
  pushl $0
80106dc9:	6a 00                	push   $0x0
  pushl $43
80106dcb:	6a 2b                	push   $0x2b
  jmp alltraps
80106dcd:	e9 47 f8 ff ff       	jmp    80106619 <alltraps>

80106dd2 <vector44>:
.globl vector44
vector44:
  pushl $0
80106dd2:	6a 00                	push   $0x0
  pushl $44
80106dd4:	6a 2c                	push   $0x2c
  jmp alltraps
80106dd6:	e9 3e f8 ff ff       	jmp    80106619 <alltraps>

80106ddb <vector45>:
.globl vector45
vector45:
  pushl $0
80106ddb:	6a 00                	push   $0x0
  pushl $45
80106ddd:	6a 2d                	push   $0x2d
  jmp alltraps
80106ddf:	e9 35 f8 ff ff       	jmp    80106619 <alltraps>

80106de4 <vector46>:
.globl vector46
vector46:
  pushl $0
80106de4:	6a 00                	push   $0x0
  pushl $46
80106de6:	6a 2e                	push   $0x2e
  jmp alltraps
80106de8:	e9 2c f8 ff ff       	jmp    80106619 <alltraps>

80106ded <vector47>:
.globl vector47
vector47:
  pushl $0
80106ded:	6a 00                	push   $0x0
  pushl $47
80106def:	6a 2f                	push   $0x2f
  jmp alltraps
80106df1:	e9 23 f8 ff ff       	jmp    80106619 <alltraps>

80106df6 <vector48>:
.globl vector48
vector48:
  pushl $0
80106df6:	6a 00                	push   $0x0
  pushl $48
80106df8:	6a 30                	push   $0x30
  jmp alltraps
80106dfa:	e9 1a f8 ff ff       	jmp    80106619 <alltraps>

80106dff <vector49>:
.globl vector49
vector49:
  pushl $0
80106dff:	6a 00                	push   $0x0
  pushl $49
80106e01:	6a 31                	push   $0x31
  jmp alltraps
80106e03:	e9 11 f8 ff ff       	jmp    80106619 <alltraps>

80106e08 <vector50>:
.globl vector50
vector50:
  pushl $0
80106e08:	6a 00                	push   $0x0
  pushl $50
80106e0a:	6a 32                	push   $0x32
  jmp alltraps
80106e0c:	e9 08 f8 ff ff       	jmp    80106619 <alltraps>

80106e11 <vector51>:
.globl vector51
vector51:
  pushl $0
80106e11:	6a 00                	push   $0x0
  pushl $51
80106e13:	6a 33                	push   $0x33
  jmp alltraps
80106e15:	e9 ff f7 ff ff       	jmp    80106619 <alltraps>

80106e1a <vector52>:
.globl vector52
vector52:
  pushl $0
80106e1a:	6a 00                	push   $0x0
  pushl $52
80106e1c:	6a 34                	push   $0x34
  jmp alltraps
80106e1e:	e9 f6 f7 ff ff       	jmp    80106619 <alltraps>

80106e23 <vector53>:
.globl vector53
vector53:
  pushl $0
80106e23:	6a 00                	push   $0x0
  pushl $53
80106e25:	6a 35                	push   $0x35
  jmp alltraps
80106e27:	e9 ed f7 ff ff       	jmp    80106619 <alltraps>

80106e2c <vector54>:
.globl vector54
vector54:
  pushl $0
80106e2c:	6a 00                	push   $0x0
  pushl $54
80106e2e:	6a 36                	push   $0x36
  jmp alltraps
80106e30:	e9 e4 f7 ff ff       	jmp    80106619 <alltraps>

80106e35 <vector55>:
.globl vector55
vector55:
  pushl $0
80106e35:	6a 00                	push   $0x0
  pushl $55
80106e37:	6a 37                	push   $0x37
  jmp alltraps
80106e39:	e9 db f7 ff ff       	jmp    80106619 <alltraps>

80106e3e <vector56>:
.globl vector56
vector56:
  pushl $0
80106e3e:	6a 00                	push   $0x0
  pushl $56
80106e40:	6a 38                	push   $0x38
  jmp alltraps
80106e42:	e9 d2 f7 ff ff       	jmp    80106619 <alltraps>

80106e47 <vector57>:
.globl vector57
vector57:
  pushl $0
80106e47:	6a 00                	push   $0x0
  pushl $57
80106e49:	6a 39                	push   $0x39
  jmp alltraps
80106e4b:	e9 c9 f7 ff ff       	jmp    80106619 <alltraps>

80106e50 <vector58>:
.globl vector58
vector58:
  pushl $0
80106e50:	6a 00                	push   $0x0
  pushl $58
80106e52:	6a 3a                	push   $0x3a
  jmp alltraps
80106e54:	e9 c0 f7 ff ff       	jmp    80106619 <alltraps>

80106e59 <vector59>:
.globl vector59
vector59:
  pushl $0
80106e59:	6a 00                	push   $0x0
  pushl $59
80106e5b:	6a 3b                	push   $0x3b
  jmp alltraps
80106e5d:	e9 b7 f7 ff ff       	jmp    80106619 <alltraps>

80106e62 <vector60>:
.globl vector60
vector60:
  pushl $0
80106e62:	6a 00                	push   $0x0
  pushl $60
80106e64:	6a 3c                	push   $0x3c
  jmp alltraps
80106e66:	e9 ae f7 ff ff       	jmp    80106619 <alltraps>

80106e6b <vector61>:
.globl vector61
vector61:
  pushl $0
80106e6b:	6a 00                	push   $0x0
  pushl $61
80106e6d:	6a 3d                	push   $0x3d
  jmp alltraps
80106e6f:	e9 a5 f7 ff ff       	jmp    80106619 <alltraps>

80106e74 <vector62>:
.globl vector62
vector62:
  pushl $0
80106e74:	6a 00                	push   $0x0
  pushl $62
80106e76:	6a 3e                	push   $0x3e
  jmp alltraps
80106e78:	e9 9c f7 ff ff       	jmp    80106619 <alltraps>

80106e7d <vector63>:
.globl vector63
vector63:
  pushl $0
80106e7d:	6a 00                	push   $0x0
  pushl $63
80106e7f:	6a 3f                	push   $0x3f
  jmp alltraps
80106e81:	e9 93 f7 ff ff       	jmp    80106619 <alltraps>

80106e86 <vector64>:
.globl vector64
vector64:
  pushl $0
80106e86:	6a 00                	push   $0x0
  pushl $64
80106e88:	6a 40                	push   $0x40
  jmp alltraps
80106e8a:	e9 8a f7 ff ff       	jmp    80106619 <alltraps>

80106e8f <vector65>:
.globl vector65
vector65:
  pushl $0
80106e8f:	6a 00                	push   $0x0
  pushl $65
80106e91:	6a 41                	push   $0x41
  jmp alltraps
80106e93:	e9 81 f7 ff ff       	jmp    80106619 <alltraps>

80106e98 <vector66>:
.globl vector66
vector66:
  pushl $0
80106e98:	6a 00                	push   $0x0
  pushl $66
80106e9a:	6a 42                	push   $0x42
  jmp alltraps
80106e9c:	e9 78 f7 ff ff       	jmp    80106619 <alltraps>

80106ea1 <vector67>:
.globl vector67
vector67:
  pushl $0
80106ea1:	6a 00                	push   $0x0
  pushl $67
80106ea3:	6a 43                	push   $0x43
  jmp alltraps
80106ea5:	e9 6f f7 ff ff       	jmp    80106619 <alltraps>

80106eaa <vector68>:
.globl vector68
vector68:
  pushl $0
80106eaa:	6a 00                	push   $0x0
  pushl $68
80106eac:	6a 44                	push   $0x44
  jmp alltraps
80106eae:	e9 66 f7 ff ff       	jmp    80106619 <alltraps>

80106eb3 <vector69>:
.globl vector69
vector69:
  pushl $0
80106eb3:	6a 00                	push   $0x0
  pushl $69
80106eb5:	6a 45                	push   $0x45
  jmp alltraps
80106eb7:	e9 5d f7 ff ff       	jmp    80106619 <alltraps>

80106ebc <vector70>:
.globl vector70
vector70:
  pushl $0
80106ebc:	6a 00                	push   $0x0
  pushl $70
80106ebe:	6a 46                	push   $0x46
  jmp alltraps
80106ec0:	e9 54 f7 ff ff       	jmp    80106619 <alltraps>

80106ec5 <vector71>:
.globl vector71
vector71:
  pushl $0
80106ec5:	6a 00                	push   $0x0
  pushl $71
80106ec7:	6a 47                	push   $0x47
  jmp alltraps
80106ec9:	e9 4b f7 ff ff       	jmp    80106619 <alltraps>

80106ece <vector72>:
.globl vector72
vector72:
  pushl $0
80106ece:	6a 00                	push   $0x0
  pushl $72
80106ed0:	6a 48                	push   $0x48
  jmp alltraps
80106ed2:	e9 42 f7 ff ff       	jmp    80106619 <alltraps>

80106ed7 <vector73>:
.globl vector73
vector73:
  pushl $0
80106ed7:	6a 00                	push   $0x0
  pushl $73
80106ed9:	6a 49                	push   $0x49
  jmp alltraps
80106edb:	e9 39 f7 ff ff       	jmp    80106619 <alltraps>

80106ee0 <vector74>:
.globl vector74
vector74:
  pushl $0
80106ee0:	6a 00                	push   $0x0
  pushl $74
80106ee2:	6a 4a                	push   $0x4a
  jmp alltraps
80106ee4:	e9 30 f7 ff ff       	jmp    80106619 <alltraps>

80106ee9 <vector75>:
.globl vector75
vector75:
  pushl $0
80106ee9:	6a 00                	push   $0x0
  pushl $75
80106eeb:	6a 4b                	push   $0x4b
  jmp alltraps
80106eed:	e9 27 f7 ff ff       	jmp    80106619 <alltraps>

80106ef2 <vector76>:
.globl vector76
vector76:
  pushl $0
80106ef2:	6a 00                	push   $0x0
  pushl $76
80106ef4:	6a 4c                	push   $0x4c
  jmp alltraps
80106ef6:	e9 1e f7 ff ff       	jmp    80106619 <alltraps>

80106efb <vector77>:
.globl vector77
vector77:
  pushl $0
80106efb:	6a 00                	push   $0x0
  pushl $77
80106efd:	6a 4d                	push   $0x4d
  jmp alltraps
80106eff:	e9 15 f7 ff ff       	jmp    80106619 <alltraps>

80106f04 <vector78>:
.globl vector78
vector78:
  pushl $0
80106f04:	6a 00                	push   $0x0
  pushl $78
80106f06:	6a 4e                	push   $0x4e
  jmp alltraps
80106f08:	e9 0c f7 ff ff       	jmp    80106619 <alltraps>

80106f0d <vector79>:
.globl vector79
vector79:
  pushl $0
80106f0d:	6a 00                	push   $0x0
  pushl $79
80106f0f:	6a 4f                	push   $0x4f
  jmp alltraps
80106f11:	e9 03 f7 ff ff       	jmp    80106619 <alltraps>

80106f16 <vector80>:
.globl vector80
vector80:
  pushl $0
80106f16:	6a 00                	push   $0x0
  pushl $80
80106f18:	6a 50                	push   $0x50
  jmp alltraps
80106f1a:	e9 fa f6 ff ff       	jmp    80106619 <alltraps>

80106f1f <vector81>:
.globl vector81
vector81:
  pushl $0
80106f1f:	6a 00                	push   $0x0
  pushl $81
80106f21:	6a 51                	push   $0x51
  jmp alltraps
80106f23:	e9 f1 f6 ff ff       	jmp    80106619 <alltraps>

80106f28 <vector82>:
.globl vector82
vector82:
  pushl $0
80106f28:	6a 00                	push   $0x0
  pushl $82
80106f2a:	6a 52                	push   $0x52
  jmp alltraps
80106f2c:	e9 e8 f6 ff ff       	jmp    80106619 <alltraps>

80106f31 <vector83>:
.globl vector83
vector83:
  pushl $0
80106f31:	6a 00                	push   $0x0
  pushl $83
80106f33:	6a 53                	push   $0x53
  jmp alltraps
80106f35:	e9 df f6 ff ff       	jmp    80106619 <alltraps>

80106f3a <vector84>:
.globl vector84
vector84:
  pushl $0
80106f3a:	6a 00                	push   $0x0
  pushl $84
80106f3c:	6a 54                	push   $0x54
  jmp alltraps
80106f3e:	e9 d6 f6 ff ff       	jmp    80106619 <alltraps>

80106f43 <vector85>:
.globl vector85
vector85:
  pushl $0
80106f43:	6a 00                	push   $0x0
  pushl $85
80106f45:	6a 55                	push   $0x55
  jmp alltraps
80106f47:	e9 cd f6 ff ff       	jmp    80106619 <alltraps>

80106f4c <vector86>:
.globl vector86
vector86:
  pushl $0
80106f4c:	6a 00                	push   $0x0
  pushl $86
80106f4e:	6a 56                	push   $0x56
  jmp alltraps
80106f50:	e9 c4 f6 ff ff       	jmp    80106619 <alltraps>

80106f55 <vector87>:
.globl vector87
vector87:
  pushl $0
80106f55:	6a 00                	push   $0x0
  pushl $87
80106f57:	6a 57                	push   $0x57
  jmp alltraps
80106f59:	e9 bb f6 ff ff       	jmp    80106619 <alltraps>

80106f5e <vector88>:
.globl vector88
vector88:
  pushl $0
80106f5e:	6a 00                	push   $0x0
  pushl $88
80106f60:	6a 58                	push   $0x58
  jmp alltraps
80106f62:	e9 b2 f6 ff ff       	jmp    80106619 <alltraps>

80106f67 <vector89>:
.globl vector89
vector89:
  pushl $0
80106f67:	6a 00                	push   $0x0
  pushl $89
80106f69:	6a 59                	push   $0x59
  jmp alltraps
80106f6b:	e9 a9 f6 ff ff       	jmp    80106619 <alltraps>

80106f70 <vector90>:
.globl vector90
vector90:
  pushl $0
80106f70:	6a 00                	push   $0x0
  pushl $90
80106f72:	6a 5a                	push   $0x5a
  jmp alltraps
80106f74:	e9 a0 f6 ff ff       	jmp    80106619 <alltraps>

80106f79 <vector91>:
.globl vector91
vector91:
  pushl $0
80106f79:	6a 00                	push   $0x0
  pushl $91
80106f7b:	6a 5b                	push   $0x5b
  jmp alltraps
80106f7d:	e9 97 f6 ff ff       	jmp    80106619 <alltraps>

80106f82 <vector92>:
.globl vector92
vector92:
  pushl $0
80106f82:	6a 00                	push   $0x0
  pushl $92
80106f84:	6a 5c                	push   $0x5c
  jmp alltraps
80106f86:	e9 8e f6 ff ff       	jmp    80106619 <alltraps>

80106f8b <vector93>:
.globl vector93
vector93:
  pushl $0
80106f8b:	6a 00                	push   $0x0
  pushl $93
80106f8d:	6a 5d                	push   $0x5d
  jmp alltraps
80106f8f:	e9 85 f6 ff ff       	jmp    80106619 <alltraps>

80106f94 <vector94>:
.globl vector94
vector94:
  pushl $0
80106f94:	6a 00                	push   $0x0
  pushl $94
80106f96:	6a 5e                	push   $0x5e
  jmp alltraps
80106f98:	e9 7c f6 ff ff       	jmp    80106619 <alltraps>

80106f9d <vector95>:
.globl vector95
vector95:
  pushl $0
80106f9d:	6a 00                	push   $0x0
  pushl $95
80106f9f:	6a 5f                	push   $0x5f
  jmp alltraps
80106fa1:	e9 73 f6 ff ff       	jmp    80106619 <alltraps>

80106fa6 <vector96>:
.globl vector96
vector96:
  pushl $0
80106fa6:	6a 00                	push   $0x0
  pushl $96
80106fa8:	6a 60                	push   $0x60
  jmp alltraps
80106faa:	e9 6a f6 ff ff       	jmp    80106619 <alltraps>

80106faf <vector97>:
.globl vector97
vector97:
  pushl $0
80106faf:	6a 00                	push   $0x0
  pushl $97
80106fb1:	6a 61                	push   $0x61
  jmp alltraps
80106fb3:	e9 61 f6 ff ff       	jmp    80106619 <alltraps>

80106fb8 <vector98>:
.globl vector98
vector98:
  pushl $0
80106fb8:	6a 00                	push   $0x0
  pushl $98
80106fba:	6a 62                	push   $0x62
  jmp alltraps
80106fbc:	e9 58 f6 ff ff       	jmp    80106619 <alltraps>

80106fc1 <vector99>:
.globl vector99
vector99:
  pushl $0
80106fc1:	6a 00                	push   $0x0
  pushl $99
80106fc3:	6a 63                	push   $0x63
  jmp alltraps
80106fc5:	e9 4f f6 ff ff       	jmp    80106619 <alltraps>

80106fca <vector100>:
.globl vector100
vector100:
  pushl $0
80106fca:	6a 00                	push   $0x0
  pushl $100
80106fcc:	6a 64                	push   $0x64
  jmp alltraps
80106fce:	e9 46 f6 ff ff       	jmp    80106619 <alltraps>

80106fd3 <vector101>:
.globl vector101
vector101:
  pushl $0
80106fd3:	6a 00                	push   $0x0
  pushl $101
80106fd5:	6a 65                	push   $0x65
  jmp alltraps
80106fd7:	e9 3d f6 ff ff       	jmp    80106619 <alltraps>

80106fdc <vector102>:
.globl vector102
vector102:
  pushl $0
80106fdc:	6a 00                	push   $0x0
  pushl $102
80106fde:	6a 66                	push   $0x66
  jmp alltraps
80106fe0:	e9 34 f6 ff ff       	jmp    80106619 <alltraps>

80106fe5 <vector103>:
.globl vector103
vector103:
  pushl $0
80106fe5:	6a 00                	push   $0x0
  pushl $103
80106fe7:	6a 67                	push   $0x67
  jmp alltraps
80106fe9:	e9 2b f6 ff ff       	jmp    80106619 <alltraps>

80106fee <vector104>:
.globl vector104
vector104:
  pushl $0
80106fee:	6a 00                	push   $0x0
  pushl $104
80106ff0:	6a 68                	push   $0x68
  jmp alltraps
80106ff2:	e9 22 f6 ff ff       	jmp    80106619 <alltraps>

80106ff7 <vector105>:
.globl vector105
vector105:
  pushl $0
80106ff7:	6a 00                	push   $0x0
  pushl $105
80106ff9:	6a 69                	push   $0x69
  jmp alltraps
80106ffb:	e9 19 f6 ff ff       	jmp    80106619 <alltraps>

80107000 <vector106>:
.globl vector106
vector106:
  pushl $0
80107000:	6a 00                	push   $0x0
  pushl $106
80107002:	6a 6a                	push   $0x6a
  jmp alltraps
80107004:	e9 10 f6 ff ff       	jmp    80106619 <alltraps>

80107009 <vector107>:
.globl vector107
vector107:
  pushl $0
80107009:	6a 00                	push   $0x0
  pushl $107
8010700b:	6a 6b                	push   $0x6b
  jmp alltraps
8010700d:	e9 07 f6 ff ff       	jmp    80106619 <alltraps>

80107012 <vector108>:
.globl vector108
vector108:
  pushl $0
80107012:	6a 00                	push   $0x0
  pushl $108
80107014:	6a 6c                	push   $0x6c
  jmp alltraps
80107016:	e9 fe f5 ff ff       	jmp    80106619 <alltraps>

8010701b <vector109>:
.globl vector109
vector109:
  pushl $0
8010701b:	6a 00                	push   $0x0
  pushl $109
8010701d:	6a 6d                	push   $0x6d
  jmp alltraps
8010701f:	e9 f5 f5 ff ff       	jmp    80106619 <alltraps>

80107024 <vector110>:
.globl vector110
vector110:
  pushl $0
80107024:	6a 00                	push   $0x0
  pushl $110
80107026:	6a 6e                	push   $0x6e
  jmp alltraps
80107028:	e9 ec f5 ff ff       	jmp    80106619 <alltraps>

8010702d <vector111>:
.globl vector111
vector111:
  pushl $0
8010702d:	6a 00                	push   $0x0
  pushl $111
8010702f:	6a 6f                	push   $0x6f
  jmp alltraps
80107031:	e9 e3 f5 ff ff       	jmp    80106619 <alltraps>

80107036 <vector112>:
.globl vector112
vector112:
  pushl $0
80107036:	6a 00                	push   $0x0
  pushl $112
80107038:	6a 70                	push   $0x70
  jmp alltraps
8010703a:	e9 da f5 ff ff       	jmp    80106619 <alltraps>

8010703f <vector113>:
.globl vector113
vector113:
  pushl $0
8010703f:	6a 00                	push   $0x0
  pushl $113
80107041:	6a 71                	push   $0x71
  jmp alltraps
80107043:	e9 d1 f5 ff ff       	jmp    80106619 <alltraps>

80107048 <vector114>:
.globl vector114
vector114:
  pushl $0
80107048:	6a 00                	push   $0x0
  pushl $114
8010704a:	6a 72                	push   $0x72
  jmp alltraps
8010704c:	e9 c8 f5 ff ff       	jmp    80106619 <alltraps>

80107051 <vector115>:
.globl vector115
vector115:
  pushl $0
80107051:	6a 00                	push   $0x0
  pushl $115
80107053:	6a 73                	push   $0x73
  jmp alltraps
80107055:	e9 bf f5 ff ff       	jmp    80106619 <alltraps>

8010705a <vector116>:
.globl vector116
vector116:
  pushl $0
8010705a:	6a 00                	push   $0x0
  pushl $116
8010705c:	6a 74                	push   $0x74
  jmp alltraps
8010705e:	e9 b6 f5 ff ff       	jmp    80106619 <alltraps>

80107063 <vector117>:
.globl vector117
vector117:
  pushl $0
80107063:	6a 00                	push   $0x0
  pushl $117
80107065:	6a 75                	push   $0x75
  jmp alltraps
80107067:	e9 ad f5 ff ff       	jmp    80106619 <alltraps>

8010706c <vector118>:
.globl vector118
vector118:
  pushl $0
8010706c:	6a 00                	push   $0x0
  pushl $118
8010706e:	6a 76                	push   $0x76
  jmp alltraps
80107070:	e9 a4 f5 ff ff       	jmp    80106619 <alltraps>

80107075 <vector119>:
.globl vector119
vector119:
  pushl $0
80107075:	6a 00                	push   $0x0
  pushl $119
80107077:	6a 77                	push   $0x77
  jmp alltraps
80107079:	e9 9b f5 ff ff       	jmp    80106619 <alltraps>

8010707e <vector120>:
.globl vector120
vector120:
  pushl $0
8010707e:	6a 00                	push   $0x0
  pushl $120
80107080:	6a 78                	push   $0x78
  jmp alltraps
80107082:	e9 92 f5 ff ff       	jmp    80106619 <alltraps>

80107087 <vector121>:
.globl vector121
vector121:
  pushl $0
80107087:	6a 00                	push   $0x0
  pushl $121
80107089:	6a 79                	push   $0x79
  jmp alltraps
8010708b:	e9 89 f5 ff ff       	jmp    80106619 <alltraps>

80107090 <vector122>:
.globl vector122
vector122:
  pushl $0
80107090:	6a 00                	push   $0x0
  pushl $122
80107092:	6a 7a                	push   $0x7a
  jmp alltraps
80107094:	e9 80 f5 ff ff       	jmp    80106619 <alltraps>

80107099 <vector123>:
.globl vector123
vector123:
  pushl $0
80107099:	6a 00                	push   $0x0
  pushl $123
8010709b:	6a 7b                	push   $0x7b
  jmp alltraps
8010709d:	e9 77 f5 ff ff       	jmp    80106619 <alltraps>

801070a2 <vector124>:
.globl vector124
vector124:
  pushl $0
801070a2:	6a 00                	push   $0x0
  pushl $124
801070a4:	6a 7c                	push   $0x7c
  jmp alltraps
801070a6:	e9 6e f5 ff ff       	jmp    80106619 <alltraps>

801070ab <vector125>:
.globl vector125
vector125:
  pushl $0
801070ab:	6a 00                	push   $0x0
  pushl $125
801070ad:	6a 7d                	push   $0x7d
  jmp alltraps
801070af:	e9 65 f5 ff ff       	jmp    80106619 <alltraps>

801070b4 <vector126>:
.globl vector126
vector126:
  pushl $0
801070b4:	6a 00                	push   $0x0
  pushl $126
801070b6:	6a 7e                	push   $0x7e
  jmp alltraps
801070b8:	e9 5c f5 ff ff       	jmp    80106619 <alltraps>

801070bd <vector127>:
.globl vector127
vector127:
  pushl $0
801070bd:	6a 00                	push   $0x0
  pushl $127
801070bf:	6a 7f                	push   $0x7f
  jmp alltraps
801070c1:	e9 53 f5 ff ff       	jmp    80106619 <alltraps>

801070c6 <vector128>:
.globl vector128
vector128:
  pushl $0
801070c6:	6a 00                	push   $0x0
  pushl $128
801070c8:	68 80 00 00 00       	push   $0x80
  jmp alltraps
801070cd:	e9 47 f5 ff ff       	jmp    80106619 <alltraps>

801070d2 <vector129>:
.globl vector129
vector129:
  pushl $0
801070d2:	6a 00                	push   $0x0
  pushl $129
801070d4:	68 81 00 00 00       	push   $0x81
  jmp alltraps
801070d9:	e9 3b f5 ff ff       	jmp    80106619 <alltraps>

801070de <vector130>:
.globl vector130
vector130:
  pushl $0
801070de:	6a 00                	push   $0x0
  pushl $130
801070e0:	68 82 00 00 00       	push   $0x82
  jmp alltraps
801070e5:	e9 2f f5 ff ff       	jmp    80106619 <alltraps>

801070ea <vector131>:
.globl vector131
vector131:
  pushl $0
801070ea:	6a 00                	push   $0x0
  pushl $131
801070ec:	68 83 00 00 00       	push   $0x83
  jmp alltraps
801070f1:	e9 23 f5 ff ff       	jmp    80106619 <alltraps>

801070f6 <vector132>:
.globl vector132
vector132:
  pushl $0
801070f6:	6a 00                	push   $0x0
  pushl $132
801070f8:	68 84 00 00 00       	push   $0x84
  jmp alltraps
801070fd:	e9 17 f5 ff ff       	jmp    80106619 <alltraps>

80107102 <vector133>:
.globl vector133
vector133:
  pushl $0
80107102:	6a 00                	push   $0x0
  pushl $133
80107104:	68 85 00 00 00       	push   $0x85
  jmp alltraps
80107109:	e9 0b f5 ff ff       	jmp    80106619 <alltraps>

8010710e <vector134>:
.globl vector134
vector134:
  pushl $0
8010710e:	6a 00                	push   $0x0
  pushl $134
80107110:	68 86 00 00 00       	push   $0x86
  jmp alltraps
80107115:	e9 ff f4 ff ff       	jmp    80106619 <alltraps>

8010711a <vector135>:
.globl vector135
vector135:
  pushl $0
8010711a:	6a 00                	push   $0x0
  pushl $135
8010711c:	68 87 00 00 00       	push   $0x87
  jmp alltraps
80107121:	e9 f3 f4 ff ff       	jmp    80106619 <alltraps>

80107126 <vector136>:
.globl vector136
vector136:
  pushl $0
80107126:	6a 00                	push   $0x0
  pushl $136
80107128:	68 88 00 00 00       	push   $0x88
  jmp alltraps
8010712d:	e9 e7 f4 ff ff       	jmp    80106619 <alltraps>

80107132 <vector137>:
.globl vector137
vector137:
  pushl $0
80107132:	6a 00                	push   $0x0
  pushl $137
80107134:	68 89 00 00 00       	push   $0x89
  jmp alltraps
80107139:	e9 db f4 ff ff       	jmp    80106619 <alltraps>

8010713e <vector138>:
.globl vector138
vector138:
  pushl $0
8010713e:	6a 00                	push   $0x0
  pushl $138
80107140:	68 8a 00 00 00       	push   $0x8a
  jmp alltraps
80107145:	e9 cf f4 ff ff       	jmp    80106619 <alltraps>

8010714a <vector139>:
.globl vector139
vector139:
  pushl $0
8010714a:	6a 00                	push   $0x0
  pushl $139
8010714c:	68 8b 00 00 00       	push   $0x8b
  jmp alltraps
80107151:	e9 c3 f4 ff ff       	jmp    80106619 <alltraps>

80107156 <vector140>:
.globl vector140
vector140:
  pushl $0
80107156:	6a 00                	push   $0x0
  pushl $140
80107158:	68 8c 00 00 00       	push   $0x8c
  jmp alltraps
8010715d:	e9 b7 f4 ff ff       	jmp    80106619 <alltraps>

80107162 <vector141>:
.globl vector141
vector141:
  pushl $0
80107162:	6a 00                	push   $0x0
  pushl $141
80107164:	68 8d 00 00 00       	push   $0x8d
  jmp alltraps
80107169:	e9 ab f4 ff ff       	jmp    80106619 <alltraps>

8010716e <vector142>:
.globl vector142
vector142:
  pushl $0
8010716e:	6a 00                	push   $0x0
  pushl $142
80107170:	68 8e 00 00 00       	push   $0x8e
  jmp alltraps
80107175:	e9 9f f4 ff ff       	jmp    80106619 <alltraps>

8010717a <vector143>:
.globl vector143
vector143:
  pushl $0
8010717a:	6a 00                	push   $0x0
  pushl $143
8010717c:	68 8f 00 00 00       	push   $0x8f
  jmp alltraps
80107181:	e9 93 f4 ff ff       	jmp    80106619 <alltraps>

80107186 <vector144>:
.globl vector144
vector144:
  pushl $0
80107186:	6a 00                	push   $0x0
  pushl $144
80107188:	68 90 00 00 00       	push   $0x90
  jmp alltraps
8010718d:	e9 87 f4 ff ff       	jmp    80106619 <alltraps>

80107192 <vector145>:
.globl vector145
vector145:
  pushl $0
80107192:	6a 00                	push   $0x0
  pushl $145
80107194:	68 91 00 00 00       	push   $0x91
  jmp alltraps
80107199:	e9 7b f4 ff ff       	jmp    80106619 <alltraps>

8010719e <vector146>:
.globl vector146
vector146:
  pushl $0
8010719e:	6a 00                	push   $0x0
  pushl $146
801071a0:	68 92 00 00 00       	push   $0x92
  jmp alltraps
801071a5:	e9 6f f4 ff ff       	jmp    80106619 <alltraps>

801071aa <vector147>:
.globl vector147
vector147:
  pushl $0
801071aa:	6a 00                	push   $0x0
  pushl $147
801071ac:	68 93 00 00 00       	push   $0x93
  jmp alltraps
801071b1:	e9 63 f4 ff ff       	jmp    80106619 <alltraps>

801071b6 <vector148>:
.globl vector148
vector148:
  pushl $0
801071b6:	6a 00                	push   $0x0
  pushl $148
801071b8:	68 94 00 00 00       	push   $0x94
  jmp alltraps
801071bd:	e9 57 f4 ff ff       	jmp    80106619 <alltraps>

801071c2 <vector149>:
.globl vector149
vector149:
  pushl $0
801071c2:	6a 00                	push   $0x0
  pushl $149
801071c4:	68 95 00 00 00       	push   $0x95
  jmp alltraps
801071c9:	e9 4b f4 ff ff       	jmp    80106619 <alltraps>

801071ce <vector150>:
.globl vector150
vector150:
  pushl $0
801071ce:	6a 00                	push   $0x0
  pushl $150
801071d0:	68 96 00 00 00       	push   $0x96
  jmp alltraps
801071d5:	e9 3f f4 ff ff       	jmp    80106619 <alltraps>

801071da <vector151>:
.globl vector151
vector151:
  pushl $0
801071da:	6a 00                	push   $0x0
  pushl $151
801071dc:	68 97 00 00 00       	push   $0x97
  jmp alltraps
801071e1:	e9 33 f4 ff ff       	jmp    80106619 <alltraps>

801071e6 <vector152>:
.globl vector152
vector152:
  pushl $0
801071e6:	6a 00                	push   $0x0
  pushl $152
801071e8:	68 98 00 00 00       	push   $0x98
  jmp alltraps
801071ed:	e9 27 f4 ff ff       	jmp    80106619 <alltraps>

801071f2 <vector153>:
.globl vector153
vector153:
  pushl $0
801071f2:	6a 00                	push   $0x0
  pushl $153
801071f4:	68 99 00 00 00       	push   $0x99
  jmp alltraps
801071f9:	e9 1b f4 ff ff       	jmp    80106619 <alltraps>

801071fe <vector154>:
.globl vector154
vector154:
  pushl $0
801071fe:	6a 00                	push   $0x0
  pushl $154
80107200:	68 9a 00 00 00       	push   $0x9a
  jmp alltraps
80107205:	e9 0f f4 ff ff       	jmp    80106619 <alltraps>

8010720a <vector155>:
.globl vector155
vector155:
  pushl $0
8010720a:	6a 00                	push   $0x0
  pushl $155
8010720c:	68 9b 00 00 00       	push   $0x9b
  jmp alltraps
80107211:	e9 03 f4 ff ff       	jmp    80106619 <alltraps>

80107216 <vector156>:
.globl vector156
vector156:
  pushl $0
80107216:	6a 00                	push   $0x0
  pushl $156
80107218:	68 9c 00 00 00       	push   $0x9c
  jmp alltraps
8010721d:	e9 f7 f3 ff ff       	jmp    80106619 <alltraps>

80107222 <vector157>:
.globl vector157
vector157:
  pushl $0
80107222:	6a 00                	push   $0x0
  pushl $157
80107224:	68 9d 00 00 00       	push   $0x9d
  jmp alltraps
80107229:	e9 eb f3 ff ff       	jmp    80106619 <alltraps>

8010722e <vector158>:
.globl vector158
vector158:
  pushl $0
8010722e:	6a 00                	push   $0x0
  pushl $158
80107230:	68 9e 00 00 00       	push   $0x9e
  jmp alltraps
80107235:	e9 df f3 ff ff       	jmp    80106619 <alltraps>

8010723a <vector159>:
.globl vector159
vector159:
  pushl $0
8010723a:	6a 00                	push   $0x0
  pushl $159
8010723c:	68 9f 00 00 00       	push   $0x9f
  jmp alltraps
80107241:	e9 d3 f3 ff ff       	jmp    80106619 <alltraps>

80107246 <vector160>:
.globl vector160
vector160:
  pushl $0
80107246:	6a 00                	push   $0x0
  pushl $160
80107248:	68 a0 00 00 00       	push   $0xa0
  jmp alltraps
8010724d:	e9 c7 f3 ff ff       	jmp    80106619 <alltraps>

80107252 <vector161>:
.globl vector161
vector161:
  pushl $0
80107252:	6a 00                	push   $0x0
  pushl $161
80107254:	68 a1 00 00 00       	push   $0xa1
  jmp alltraps
80107259:	e9 bb f3 ff ff       	jmp    80106619 <alltraps>

8010725e <vector162>:
.globl vector162
vector162:
  pushl $0
8010725e:	6a 00                	push   $0x0
  pushl $162
80107260:	68 a2 00 00 00       	push   $0xa2
  jmp alltraps
80107265:	e9 af f3 ff ff       	jmp    80106619 <alltraps>

8010726a <vector163>:
.globl vector163
vector163:
  pushl $0
8010726a:	6a 00                	push   $0x0
  pushl $163
8010726c:	68 a3 00 00 00       	push   $0xa3
  jmp alltraps
80107271:	e9 a3 f3 ff ff       	jmp    80106619 <alltraps>

80107276 <vector164>:
.globl vector164
vector164:
  pushl $0
80107276:	6a 00                	push   $0x0
  pushl $164
80107278:	68 a4 00 00 00       	push   $0xa4
  jmp alltraps
8010727d:	e9 97 f3 ff ff       	jmp    80106619 <alltraps>

80107282 <vector165>:
.globl vector165
vector165:
  pushl $0
80107282:	6a 00                	push   $0x0
  pushl $165
80107284:	68 a5 00 00 00       	push   $0xa5
  jmp alltraps
80107289:	e9 8b f3 ff ff       	jmp    80106619 <alltraps>

8010728e <vector166>:
.globl vector166
vector166:
  pushl $0
8010728e:	6a 00                	push   $0x0
  pushl $166
80107290:	68 a6 00 00 00       	push   $0xa6
  jmp alltraps
80107295:	e9 7f f3 ff ff       	jmp    80106619 <alltraps>

8010729a <vector167>:
.globl vector167
vector167:
  pushl $0
8010729a:	6a 00                	push   $0x0
  pushl $167
8010729c:	68 a7 00 00 00       	push   $0xa7
  jmp alltraps
801072a1:	e9 73 f3 ff ff       	jmp    80106619 <alltraps>

801072a6 <vector168>:
.globl vector168
vector168:
  pushl $0
801072a6:	6a 00                	push   $0x0
  pushl $168
801072a8:	68 a8 00 00 00       	push   $0xa8
  jmp alltraps
801072ad:	e9 67 f3 ff ff       	jmp    80106619 <alltraps>

801072b2 <vector169>:
.globl vector169
vector169:
  pushl $0
801072b2:	6a 00                	push   $0x0
  pushl $169
801072b4:	68 a9 00 00 00       	push   $0xa9
  jmp alltraps
801072b9:	e9 5b f3 ff ff       	jmp    80106619 <alltraps>

801072be <vector170>:
.globl vector170
vector170:
  pushl $0
801072be:	6a 00                	push   $0x0
  pushl $170
801072c0:	68 aa 00 00 00       	push   $0xaa
  jmp alltraps
801072c5:	e9 4f f3 ff ff       	jmp    80106619 <alltraps>

801072ca <vector171>:
.globl vector171
vector171:
  pushl $0
801072ca:	6a 00                	push   $0x0
  pushl $171
801072cc:	68 ab 00 00 00       	push   $0xab
  jmp alltraps
801072d1:	e9 43 f3 ff ff       	jmp    80106619 <alltraps>

801072d6 <vector172>:
.globl vector172
vector172:
  pushl $0
801072d6:	6a 00                	push   $0x0
  pushl $172
801072d8:	68 ac 00 00 00       	push   $0xac
  jmp alltraps
801072dd:	e9 37 f3 ff ff       	jmp    80106619 <alltraps>

801072e2 <vector173>:
.globl vector173
vector173:
  pushl $0
801072e2:	6a 00                	push   $0x0
  pushl $173
801072e4:	68 ad 00 00 00       	push   $0xad
  jmp alltraps
801072e9:	e9 2b f3 ff ff       	jmp    80106619 <alltraps>

801072ee <vector174>:
.globl vector174
vector174:
  pushl $0
801072ee:	6a 00                	push   $0x0
  pushl $174
801072f0:	68 ae 00 00 00       	push   $0xae
  jmp alltraps
801072f5:	e9 1f f3 ff ff       	jmp    80106619 <alltraps>

801072fa <vector175>:
.globl vector175
vector175:
  pushl $0
801072fa:	6a 00                	push   $0x0
  pushl $175
801072fc:	68 af 00 00 00       	push   $0xaf
  jmp alltraps
80107301:	e9 13 f3 ff ff       	jmp    80106619 <alltraps>

80107306 <vector176>:
.globl vector176
vector176:
  pushl $0
80107306:	6a 00                	push   $0x0
  pushl $176
80107308:	68 b0 00 00 00       	push   $0xb0
  jmp alltraps
8010730d:	e9 07 f3 ff ff       	jmp    80106619 <alltraps>

80107312 <vector177>:
.globl vector177
vector177:
  pushl $0
80107312:	6a 00                	push   $0x0
  pushl $177
80107314:	68 b1 00 00 00       	push   $0xb1
  jmp alltraps
80107319:	e9 fb f2 ff ff       	jmp    80106619 <alltraps>

8010731e <vector178>:
.globl vector178
vector178:
  pushl $0
8010731e:	6a 00                	push   $0x0
  pushl $178
80107320:	68 b2 00 00 00       	push   $0xb2
  jmp alltraps
80107325:	e9 ef f2 ff ff       	jmp    80106619 <alltraps>

8010732a <vector179>:
.globl vector179
vector179:
  pushl $0
8010732a:	6a 00                	push   $0x0
  pushl $179
8010732c:	68 b3 00 00 00       	push   $0xb3
  jmp alltraps
80107331:	e9 e3 f2 ff ff       	jmp    80106619 <alltraps>

80107336 <vector180>:
.globl vector180
vector180:
  pushl $0
80107336:	6a 00                	push   $0x0
  pushl $180
80107338:	68 b4 00 00 00       	push   $0xb4
  jmp alltraps
8010733d:	e9 d7 f2 ff ff       	jmp    80106619 <alltraps>

80107342 <vector181>:
.globl vector181
vector181:
  pushl $0
80107342:	6a 00                	push   $0x0
  pushl $181
80107344:	68 b5 00 00 00       	push   $0xb5
  jmp alltraps
80107349:	e9 cb f2 ff ff       	jmp    80106619 <alltraps>

8010734e <vector182>:
.globl vector182
vector182:
  pushl $0
8010734e:	6a 00                	push   $0x0
  pushl $182
80107350:	68 b6 00 00 00       	push   $0xb6
  jmp alltraps
80107355:	e9 bf f2 ff ff       	jmp    80106619 <alltraps>

8010735a <vector183>:
.globl vector183
vector183:
  pushl $0
8010735a:	6a 00                	push   $0x0
  pushl $183
8010735c:	68 b7 00 00 00       	push   $0xb7
  jmp alltraps
80107361:	e9 b3 f2 ff ff       	jmp    80106619 <alltraps>

80107366 <vector184>:
.globl vector184
vector184:
  pushl $0
80107366:	6a 00                	push   $0x0
  pushl $184
80107368:	68 b8 00 00 00       	push   $0xb8
  jmp alltraps
8010736d:	e9 a7 f2 ff ff       	jmp    80106619 <alltraps>

80107372 <vector185>:
.globl vector185
vector185:
  pushl $0
80107372:	6a 00                	push   $0x0
  pushl $185
80107374:	68 b9 00 00 00       	push   $0xb9
  jmp alltraps
80107379:	e9 9b f2 ff ff       	jmp    80106619 <alltraps>

8010737e <vector186>:
.globl vector186
vector186:
  pushl $0
8010737e:	6a 00                	push   $0x0
  pushl $186
80107380:	68 ba 00 00 00       	push   $0xba
  jmp alltraps
80107385:	e9 8f f2 ff ff       	jmp    80106619 <alltraps>

8010738a <vector187>:
.globl vector187
vector187:
  pushl $0
8010738a:	6a 00                	push   $0x0
  pushl $187
8010738c:	68 bb 00 00 00       	push   $0xbb
  jmp alltraps
80107391:	e9 83 f2 ff ff       	jmp    80106619 <alltraps>

80107396 <vector188>:
.globl vector188
vector188:
  pushl $0
80107396:	6a 00                	push   $0x0
  pushl $188
80107398:	68 bc 00 00 00       	push   $0xbc
  jmp alltraps
8010739d:	e9 77 f2 ff ff       	jmp    80106619 <alltraps>

801073a2 <vector189>:
.globl vector189
vector189:
  pushl $0
801073a2:	6a 00                	push   $0x0
  pushl $189
801073a4:	68 bd 00 00 00       	push   $0xbd
  jmp alltraps
801073a9:	e9 6b f2 ff ff       	jmp    80106619 <alltraps>

801073ae <vector190>:
.globl vector190
vector190:
  pushl $0
801073ae:	6a 00                	push   $0x0
  pushl $190
801073b0:	68 be 00 00 00       	push   $0xbe
  jmp alltraps
801073b5:	e9 5f f2 ff ff       	jmp    80106619 <alltraps>

801073ba <vector191>:
.globl vector191
vector191:
  pushl $0
801073ba:	6a 00                	push   $0x0
  pushl $191
801073bc:	68 bf 00 00 00       	push   $0xbf
  jmp alltraps
801073c1:	e9 53 f2 ff ff       	jmp    80106619 <alltraps>

801073c6 <vector192>:
.globl vector192
vector192:
  pushl $0
801073c6:	6a 00                	push   $0x0
  pushl $192
801073c8:	68 c0 00 00 00       	push   $0xc0
  jmp alltraps
801073cd:	e9 47 f2 ff ff       	jmp    80106619 <alltraps>

801073d2 <vector193>:
.globl vector193
vector193:
  pushl $0
801073d2:	6a 00                	push   $0x0
  pushl $193
801073d4:	68 c1 00 00 00       	push   $0xc1
  jmp alltraps
801073d9:	e9 3b f2 ff ff       	jmp    80106619 <alltraps>

801073de <vector194>:
.globl vector194
vector194:
  pushl $0
801073de:	6a 00                	push   $0x0
  pushl $194
801073e0:	68 c2 00 00 00       	push   $0xc2
  jmp alltraps
801073e5:	e9 2f f2 ff ff       	jmp    80106619 <alltraps>

801073ea <vector195>:
.globl vector195
vector195:
  pushl $0
801073ea:	6a 00                	push   $0x0
  pushl $195
801073ec:	68 c3 00 00 00       	push   $0xc3
  jmp alltraps
801073f1:	e9 23 f2 ff ff       	jmp    80106619 <alltraps>

801073f6 <vector196>:
.globl vector196
vector196:
  pushl $0
801073f6:	6a 00                	push   $0x0
  pushl $196
801073f8:	68 c4 00 00 00       	push   $0xc4
  jmp alltraps
801073fd:	e9 17 f2 ff ff       	jmp    80106619 <alltraps>

80107402 <vector197>:
.globl vector197
vector197:
  pushl $0
80107402:	6a 00                	push   $0x0
  pushl $197
80107404:	68 c5 00 00 00       	push   $0xc5
  jmp alltraps
80107409:	e9 0b f2 ff ff       	jmp    80106619 <alltraps>

8010740e <vector198>:
.globl vector198
vector198:
  pushl $0
8010740e:	6a 00                	push   $0x0
  pushl $198
80107410:	68 c6 00 00 00       	push   $0xc6
  jmp alltraps
80107415:	e9 ff f1 ff ff       	jmp    80106619 <alltraps>

8010741a <vector199>:
.globl vector199
vector199:
  pushl $0
8010741a:	6a 00                	push   $0x0
  pushl $199
8010741c:	68 c7 00 00 00       	push   $0xc7
  jmp alltraps
80107421:	e9 f3 f1 ff ff       	jmp    80106619 <alltraps>

80107426 <vector200>:
.globl vector200
vector200:
  pushl $0
80107426:	6a 00                	push   $0x0
  pushl $200
80107428:	68 c8 00 00 00       	push   $0xc8
  jmp alltraps
8010742d:	e9 e7 f1 ff ff       	jmp    80106619 <alltraps>

80107432 <vector201>:
.globl vector201
vector201:
  pushl $0
80107432:	6a 00                	push   $0x0
  pushl $201
80107434:	68 c9 00 00 00       	push   $0xc9
  jmp alltraps
80107439:	e9 db f1 ff ff       	jmp    80106619 <alltraps>

8010743e <vector202>:
.globl vector202
vector202:
  pushl $0
8010743e:	6a 00                	push   $0x0
  pushl $202
80107440:	68 ca 00 00 00       	push   $0xca
  jmp alltraps
80107445:	e9 cf f1 ff ff       	jmp    80106619 <alltraps>

8010744a <vector203>:
.globl vector203
vector203:
  pushl $0
8010744a:	6a 00                	push   $0x0
  pushl $203
8010744c:	68 cb 00 00 00       	push   $0xcb
  jmp alltraps
80107451:	e9 c3 f1 ff ff       	jmp    80106619 <alltraps>

80107456 <vector204>:
.globl vector204
vector204:
  pushl $0
80107456:	6a 00                	push   $0x0
  pushl $204
80107458:	68 cc 00 00 00       	push   $0xcc
  jmp alltraps
8010745d:	e9 b7 f1 ff ff       	jmp    80106619 <alltraps>

80107462 <vector205>:
.globl vector205
vector205:
  pushl $0
80107462:	6a 00                	push   $0x0
  pushl $205
80107464:	68 cd 00 00 00       	push   $0xcd
  jmp alltraps
80107469:	e9 ab f1 ff ff       	jmp    80106619 <alltraps>

8010746e <vector206>:
.globl vector206
vector206:
  pushl $0
8010746e:	6a 00                	push   $0x0
  pushl $206
80107470:	68 ce 00 00 00       	push   $0xce
  jmp alltraps
80107475:	e9 9f f1 ff ff       	jmp    80106619 <alltraps>

8010747a <vector207>:
.globl vector207
vector207:
  pushl $0
8010747a:	6a 00                	push   $0x0
  pushl $207
8010747c:	68 cf 00 00 00       	push   $0xcf
  jmp alltraps
80107481:	e9 93 f1 ff ff       	jmp    80106619 <alltraps>

80107486 <vector208>:
.globl vector208
vector208:
  pushl $0
80107486:	6a 00                	push   $0x0
  pushl $208
80107488:	68 d0 00 00 00       	push   $0xd0
  jmp alltraps
8010748d:	e9 87 f1 ff ff       	jmp    80106619 <alltraps>

80107492 <vector209>:
.globl vector209
vector209:
  pushl $0
80107492:	6a 00                	push   $0x0
  pushl $209
80107494:	68 d1 00 00 00       	push   $0xd1
  jmp alltraps
80107499:	e9 7b f1 ff ff       	jmp    80106619 <alltraps>

8010749e <vector210>:
.globl vector210
vector210:
  pushl $0
8010749e:	6a 00                	push   $0x0
  pushl $210
801074a0:	68 d2 00 00 00       	push   $0xd2
  jmp alltraps
801074a5:	e9 6f f1 ff ff       	jmp    80106619 <alltraps>

801074aa <vector211>:
.globl vector211
vector211:
  pushl $0
801074aa:	6a 00                	push   $0x0
  pushl $211
801074ac:	68 d3 00 00 00       	push   $0xd3
  jmp alltraps
801074b1:	e9 63 f1 ff ff       	jmp    80106619 <alltraps>

801074b6 <vector212>:
.globl vector212
vector212:
  pushl $0
801074b6:	6a 00                	push   $0x0
  pushl $212
801074b8:	68 d4 00 00 00       	push   $0xd4
  jmp alltraps
801074bd:	e9 57 f1 ff ff       	jmp    80106619 <alltraps>

801074c2 <vector213>:
.globl vector213
vector213:
  pushl $0
801074c2:	6a 00                	push   $0x0
  pushl $213
801074c4:	68 d5 00 00 00       	push   $0xd5
  jmp alltraps
801074c9:	e9 4b f1 ff ff       	jmp    80106619 <alltraps>

801074ce <vector214>:
.globl vector214
vector214:
  pushl $0
801074ce:	6a 00                	push   $0x0
  pushl $214
801074d0:	68 d6 00 00 00       	push   $0xd6
  jmp alltraps
801074d5:	e9 3f f1 ff ff       	jmp    80106619 <alltraps>

801074da <vector215>:
.globl vector215
vector215:
  pushl $0
801074da:	6a 00                	push   $0x0
  pushl $215
801074dc:	68 d7 00 00 00       	push   $0xd7
  jmp alltraps
801074e1:	e9 33 f1 ff ff       	jmp    80106619 <alltraps>

801074e6 <vector216>:
.globl vector216
vector216:
  pushl $0
801074e6:	6a 00                	push   $0x0
  pushl $216
801074e8:	68 d8 00 00 00       	push   $0xd8
  jmp alltraps
801074ed:	e9 27 f1 ff ff       	jmp    80106619 <alltraps>

801074f2 <vector217>:
.globl vector217
vector217:
  pushl $0
801074f2:	6a 00                	push   $0x0
  pushl $217
801074f4:	68 d9 00 00 00       	push   $0xd9
  jmp alltraps
801074f9:	e9 1b f1 ff ff       	jmp    80106619 <alltraps>

801074fe <vector218>:
.globl vector218
vector218:
  pushl $0
801074fe:	6a 00                	push   $0x0
  pushl $218
80107500:	68 da 00 00 00       	push   $0xda
  jmp alltraps
80107505:	e9 0f f1 ff ff       	jmp    80106619 <alltraps>

8010750a <vector219>:
.globl vector219
vector219:
  pushl $0
8010750a:	6a 00                	push   $0x0
  pushl $219
8010750c:	68 db 00 00 00       	push   $0xdb
  jmp alltraps
80107511:	e9 03 f1 ff ff       	jmp    80106619 <alltraps>

80107516 <vector220>:
.globl vector220
vector220:
  pushl $0
80107516:	6a 00                	push   $0x0
  pushl $220
80107518:	68 dc 00 00 00       	push   $0xdc
  jmp alltraps
8010751d:	e9 f7 f0 ff ff       	jmp    80106619 <alltraps>

80107522 <vector221>:
.globl vector221
vector221:
  pushl $0
80107522:	6a 00                	push   $0x0
  pushl $221
80107524:	68 dd 00 00 00       	push   $0xdd
  jmp alltraps
80107529:	e9 eb f0 ff ff       	jmp    80106619 <alltraps>

8010752e <vector222>:
.globl vector222
vector222:
  pushl $0
8010752e:	6a 00                	push   $0x0
  pushl $222
80107530:	68 de 00 00 00       	push   $0xde
  jmp alltraps
80107535:	e9 df f0 ff ff       	jmp    80106619 <alltraps>

8010753a <vector223>:
.globl vector223
vector223:
  pushl $0
8010753a:	6a 00                	push   $0x0
  pushl $223
8010753c:	68 df 00 00 00       	push   $0xdf
  jmp alltraps
80107541:	e9 d3 f0 ff ff       	jmp    80106619 <alltraps>

80107546 <vector224>:
.globl vector224
vector224:
  pushl $0
80107546:	6a 00                	push   $0x0
  pushl $224
80107548:	68 e0 00 00 00       	push   $0xe0
  jmp alltraps
8010754d:	e9 c7 f0 ff ff       	jmp    80106619 <alltraps>

80107552 <vector225>:
.globl vector225
vector225:
  pushl $0
80107552:	6a 00                	push   $0x0
  pushl $225
80107554:	68 e1 00 00 00       	push   $0xe1
  jmp alltraps
80107559:	e9 bb f0 ff ff       	jmp    80106619 <alltraps>

8010755e <vector226>:
.globl vector226
vector226:
  pushl $0
8010755e:	6a 00                	push   $0x0
  pushl $226
80107560:	68 e2 00 00 00       	push   $0xe2
  jmp alltraps
80107565:	e9 af f0 ff ff       	jmp    80106619 <alltraps>

8010756a <vector227>:
.globl vector227
vector227:
  pushl $0
8010756a:	6a 00                	push   $0x0
  pushl $227
8010756c:	68 e3 00 00 00       	push   $0xe3
  jmp alltraps
80107571:	e9 a3 f0 ff ff       	jmp    80106619 <alltraps>

80107576 <vector228>:
.globl vector228
vector228:
  pushl $0
80107576:	6a 00                	push   $0x0
  pushl $228
80107578:	68 e4 00 00 00       	push   $0xe4
  jmp alltraps
8010757d:	e9 97 f0 ff ff       	jmp    80106619 <alltraps>

80107582 <vector229>:
.globl vector229
vector229:
  pushl $0
80107582:	6a 00                	push   $0x0
  pushl $229
80107584:	68 e5 00 00 00       	push   $0xe5
  jmp alltraps
80107589:	e9 8b f0 ff ff       	jmp    80106619 <alltraps>

8010758e <vector230>:
.globl vector230
vector230:
  pushl $0
8010758e:	6a 00                	push   $0x0
  pushl $230
80107590:	68 e6 00 00 00       	push   $0xe6
  jmp alltraps
80107595:	e9 7f f0 ff ff       	jmp    80106619 <alltraps>

8010759a <vector231>:
.globl vector231
vector231:
  pushl $0
8010759a:	6a 00                	push   $0x0
  pushl $231
8010759c:	68 e7 00 00 00       	push   $0xe7
  jmp alltraps
801075a1:	e9 73 f0 ff ff       	jmp    80106619 <alltraps>

801075a6 <vector232>:
.globl vector232
vector232:
  pushl $0
801075a6:	6a 00                	push   $0x0
  pushl $232
801075a8:	68 e8 00 00 00       	push   $0xe8
  jmp alltraps
801075ad:	e9 67 f0 ff ff       	jmp    80106619 <alltraps>

801075b2 <vector233>:
.globl vector233
vector233:
  pushl $0
801075b2:	6a 00                	push   $0x0
  pushl $233
801075b4:	68 e9 00 00 00       	push   $0xe9
  jmp alltraps
801075b9:	e9 5b f0 ff ff       	jmp    80106619 <alltraps>

801075be <vector234>:
.globl vector234
vector234:
  pushl $0
801075be:	6a 00                	push   $0x0
  pushl $234
801075c0:	68 ea 00 00 00       	push   $0xea
  jmp alltraps
801075c5:	e9 4f f0 ff ff       	jmp    80106619 <alltraps>

801075ca <vector235>:
.globl vector235
vector235:
  pushl $0
801075ca:	6a 00                	push   $0x0
  pushl $235
801075cc:	68 eb 00 00 00       	push   $0xeb
  jmp alltraps
801075d1:	e9 43 f0 ff ff       	jmp    80106619 <alltraps>

801075d6 <vector236>:
.globl vector236
vector236:
  pushl $0
801075d6:	6a 00                	push   $0x0
  pushl $236
801075d8:	68 ec 00 00 00       	push   $0xec
  jmp alltraps
801075dd:	e9 37 f0 ff ff       	jmp    80106619 <alltraps>

801075e2 <vector237>:
.globl vector237
vector237:
  pushl $0
801075e2:	6a 00                	push   $0x0
  pushl $237
801075e4:	68 ed 00 00 00       	push   $0xed
  jmp alltraps
801075e9:	e9 2b f0 ff ff       	jmp    80106619 <alltraps>

801075ee <vector238>:
.globl vector238
vector238:
  pushl $0
801075ee:	6a 00                	push   $0x0
  pushl $238
801075f0:	68 ee 00 00 00       	push   $0xee
  jmp alltraps
801075f5:	e9 1f f0 ff ff       	jmp    80106619 <alltraps>

801075fa <vector239>:
.globl vector239
vector239:
  pushl $0
801075fa:	6a 00                	push   $0x0
  pushl $239
801075fc:	68 ef 00 00 00       	push   $0xef
  jmp alltraps
80107601:	e9 13 f0 ff ff       	jmp    80106619 <alltraps>

80107606 <vector240>:
.globl vector240
vector240:
  pushl $0
80107606:	6a 00                	push   $0x0
  pushl $240
80107608:	68 f0 00 00 00       	push   $0xf0
  jmp alltraps
8010760d:	e9 07 f0 ff ff       	jmp    80106619 <alltraps>

80107612 <vector241>:
.globl vector241
vector241:
  pushl $0
80107612:	6a 00                	push   $0x0
  pushl $241
80107614:	68 f1 00 00 00       	push   $0xf1
  jmp alltraps
80107619:	e9 fb ef ff ff       	jmp    80106619 <alltraps>

8010761e <vector242>:
.globl vector242
vector242:
  pushl $0
8010761e:	6a 00                	push   $0x0
  pushl $242
80107620:	68 f2 00 00 00       	push   $0xf2
  jmp alltraps
80107625:	e9 ef ef ff ff       	jmp    80106619 <alltraps>

8010762a <vector243>:
.globl vector243
vector243:
  pushl $0
8010762a:	6a 00                	push   $0x0
  pushl $243
8010762c:	68 f3 00 00 00       	push   $0xf3
  jmp alltraps
80107631:	e9 e3 ef ff ff       	jmp    80106619 <alltraps>

80107636 <vector244>:
.globl vector244
vector244:
  pushl $0
80107636:	6a 00                	push   $0x0
  pushl $244
80107638:	68 f4 00 00 00       	push   $0xf4
  jmp alltraps
8010763d:	e9 d7 ef ff ff       	jmp    80106619 <alltraps>

80107642 <vector245>:
.globl vector245
vector245:
  pushl $0
80107642:	6a 00                	push   $0x0
  pushl $245
80107644:	68 f5 00 00 00       	push   $0xf5
  jmp alltraps
80107649:	e9 cb ef ff ff       	jmp    80106619 <alltraps>

8010764e <vector246>:
.globl vector246
vector246:
  pushl $0
8010764e:	6a 00                	push   $0x0
  pushl $246
80107650:	68 f6 00 00 00       	push   $0xf6
  jmp alltraps
80107655:	e9 bf ef ff ff       	jmp    80106619 <alltraps>

8010765a <vector247>:
.globl vector247
vector247:
  pushl $0
8010765a:	6a 00                	push   $0x0
  pushl $247
8010765c:	68 f7 00 00 00       	push   $0xf7
  jmp alltraps
80107661:	e9 b3 ef ff ff       	jmp    80106619 <alltraps>

80107666 <vector248>:
.globl vector248
vector248:
  pushl $0
80107666:	6a 00                	push   $0x0
  pushl $248
80107668:	68 f8 00 00 00       	push   $0xf8
  jmp alltraps
8010766d:	e9 a7 ef ff ff       	jmp    80106619 <alltraps>

80107672 <vector249>:
.globl vector249
vector249:
  pushl $0
80107672:	6a 00                	push   $0x0
  pushl $249
80107674:	68 f9 00 00 00       	push   $0xf9
  jmp alltraps
80107679:	e9 9b ef ff ff       	jmp    80106619 <alltraps>

8010767e <vector250>:
.globl vector250
vector250:
  pushl $0
8010767e:	6a 00                	push   $0x0
  pushl $250
80107680:	68 fa 00 00 00       	push   $0xfa
  jmp alltraps
80107685:	e9 8f ef ff ff       	jmp    80106619 <alltraps>

8010768a <vector251>:
.globl vector251
vector251:
  pushl $0
8010768a:	6a 00                	push   $0x0
  pushl $251
8010768c:	68 fb 00 00 00       	push   $0xfb
  jmp alltraps
80107691:	e9 83 ef ff ff       	jmp    80106619 <alltraps>

80107696 <vector252>:
.globl vector252
vector252:
  pushl $0
80107696:	6a 00                	push   $0x0
  pushl $252
80107698:	68 fc 00 00 00       	push   $0xfc
  jmp alltraps
8010769d:	e9 77 ef ff ff       	jmp    80106619 <alltraps>

801076a2 <vector253>:
.globl vector253
vector253:
  pushl $0
801076a2:	6a 00                	push   $0x0
  pushl $253
801076a4:	68 fd 00 00 00       	push   $0xfd
  jmp alltraps
801076a9:	e9 6b ef ff ff       	jmp    80106619 <alltraps>

801076ae <vector254>:
.globl vector254
vector254:
  pushl $0
801076ae:	6a 00                	push   $0x0
  pushl $254
801076b0:	68 fe 00 00 00       	push   $0xfe
  jmp alltraps
801076b5:	e9 5f ef ff ff       	jmp    80106619 <alltraps>

801076ba <vector255>:
.globl vector255
vector255:
  pushl $0
801076ba:	6a 00                	push   $0x0
  pushl $255
801076bc:	68 ff 00 00 00       	push   $0xff
  jmp alltraps
801076c1:	e9 53 ef ff ff       	jmp    80106619 <alltraps>

801076c6 <lgdt>:
{
801076c6:	55                   	push   %ebp
801076c7:	89 e5                	mov    %esp,%ebp
801076c9:	83 ec 10             	sub    $0x10,%esp
  pd[0] = size-1;
801076cc:	8b 45 0c             	mov    0xc(%ebp),%eax
801076cf:	83 e8 01             	sub    $0x1,%eax
801076d2:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  pd[1] = (uint)p;
801076d6:	8b 45 08             	mov    0x8(%ebp),%eax
801076d9:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  pd[2] = (uint)p >> 16;
801076dd:	8b 45 08             	mov    0x8(%ebp),%eax
801076e0:	c1 e8 10             	shr    $0x10,%eax
801076e3:	66 89 45 fe          	mov    %ax,-0x2(%ebp)
  asm volatile("lgdt (%0)" : : "r" (pd));
801076e7:	8d 45 fa             	lea    -0x6(%ebp),%eax
801076ea:	0f 01 10             	lgdtl  (%eax)
}
801076ed:	90                   	nop
801076ee:	c9                   	leave  
801076ef:	c3                   	ret    

801076f0 <ltr>:
{
801076f0:	55                   	push   %ebp
801076f1:	89 e5                	mov    %esp,%ebp
801076f3:	83 ec 04             	sub    $0x4,%esp
801076f6:	8b 45 08             	mov    0x8(%ebp),%eax
801076f9:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  asm volatile("ltr %0" : : "r" (sel));
801076fd:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80107701:	0f 00 d8             	ltr    %ax
}
80107704:	90                   	nop
80107705:	c9                   	leave  
80107706:	c3                   	ret    

80107707 <rcr2>:
{
80107707:	55                   	push   %ebp
80107708:	89 e5                	mov    %esp,%ebp
8010770a:	83 ec 10             	sub    $0x10,%esp
  asm volatile("movl %%cr2,%0" : "=r" (val));
8010770d:	0f 20 d0             	mov    %cr2,%eax
80107710:	89 45 fc             	mov    %eax,-0x4(%ebp)
  return val;
80107713:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80107716:	c9                   	leave  
80107717:	c3                   	ret    

80107718 <lcr3>:

static inline void
lcr3(uint val)
{
80107718:	55                   	push   %ebp
80107719:	89 e5                	mov    %esp,%ebp
  asm volatile("movl %0,%%cr3" : : "r" (val));
8010771b:	8b 45 08             	mov    0x8(%ebp),%eax
8010771e:	0f 22 d8             	mov    %eax,%cr3
}
80107721:	90                   	nop
80107722:	5d                   	pop    %ebp
80107723:	c3                   	ret    

80107724 <seginit>:

// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
80107724:	55                   	push   %ebp
80107725:	89 e5                	mov    %esp,%ebp
80107727:	83 ec 18             	sub    $0x18,%esp

  // Map "logical" addresses to virtual addresses using identity map.
  // Cannot share a CODE descriptor for both kernel and user
  // because it would have to have DPL_USR, but the CPU forbids
  // an interrupt from CPL=0 to DPL=3.
  c = &cpus[cpuid()];
8010772a:	e8 1a cb ff ff       	call   80104249 <cpuid>
8010772f:	69 c0 b0 00 00 00    	imul   $0xb0,%eax,%eax
80107735:	05 e0 27 11 80       	add    $0x801127e0,%eax
8010773a:	89 45 f4             	mov    %eax,-0xc(%ebp)
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010773d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107740:	66 c7 40 78 ff ff    	movw   $0xffff,0x78(%eax)
80107746:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107749:	66 c7 40 7a 00 00    	movw   $0x0,0x7a(%eax)
8010774f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107752:	c6 40 7c 00          	movb   $0x0,0x7c(%eax)
80107756:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107759:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
8010775d:	83 e2 f0             	and    $0xfffffff0,%edx
80107760:	83 ca 0a             	or     $0xa,%edx
80107763:	88 50 7d             	mov    %dl,0x7d(%eax)
80107766:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107769:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
8010776d:	83 ca 10             	or     $0x10,%edx
80107770:	88 50 7d             	mov    %dl,0x7d(%eax)
80107773:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107776:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
8010777a:	83 e2 9f             	and    $0xffffff9f,%edx
8010777d:	88 50 7d             	mov    %dl,0x7d(%eax)
80107780:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107783:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80107787:	83 ca 80             	or     $0xffffff80,%edx
8010778a:	88 50 7d             	mov    %dl,0x7d(%eax)
8010778d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107790:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
80107794:	83 ca 0f             	or     $0xf,%edx
80107797:	88 50 7e             	mov    %dl,0x7e(%eax)
8010779a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010779d:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801077a1:	83 e2 ef             	and    $0xffffffef,%edx
801077a4:	88 50 7e             	mov    %dl,0x7e(%eax)
801077a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077aa:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801077ae:	83 e2 df             	and    $0xffffffdf,%edx
801077b1:	88 50 7e             	mov    %dl,0x7e(%eax)
801077b4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077b7:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801077bb:	83 ca 40             	or     $0x40,%edx
801077be:	88 50 7e             	mov    %dl,0x7e(%eax)
801077c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077c4:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801077c8:	83 ca 80             	or     $0xffffff80,%edx
801077cb:	88 50 7e             	mov    %dl,0x7e(%eax)
801077ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077d1:	c6 40 7f 00          	movb   $0x0,0x7f(%eax)
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801077d5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077d8:	66 c7 80 80 00 00 00 	movw   $0xffff,0x80(%eax)
801077df:	ff ff 
801077e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077e4:	66 c7 80 82 00 00 00 	movw   $0x0,0x82(%eax)
801077eb:	00 00 
801077ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077f0:	c6 80 84 00 00 00 00 	movb   $0x0,0x84(%eax)
801077f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801077fa:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80107801:	83 e2 f0             	and    $0xfffffff0,%edx
80107804:	83 ca 02             	or     $0x2,%edx
80107807:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
8010780d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107810:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80107817:	83 ca 10             	or     $0x10,%edx
8010781a:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80107820:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107823:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
8010782a:	83 e2 9f             	and    $0xffffff9f,%edx
8010782d:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80107833:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107836:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
8010783d:	83 ca 80             	or     $0xffffff80,%edx
80107840:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80107846:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107849:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107850:	83 ca 0f             	or     $0xf,%edx
80107853:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107859:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010785c:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107863:	83 e2 ef             	and    $0xffffffef,%edx
80107866:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
8010786c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010786f:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107876:	83 e2 df             	and    $0xffffffdf,%edx
80107879:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
8010787f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107882:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107889:	83 ca 40             	or     $0x40,%edx
8010788c:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107892:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107895:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
8010789c:	83 ca 80             	or     $0xffffff80,%edx
8010789f:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
801078a5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801078a8:	c6 80 87 00 00 00 00 	movb   $0x0,0x87(%eax)
  c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801078af:	8b 45 f4             	mov    -0xc(%ebp),%eax
801078b2:	66 c7 80 88 00 00 00 	movw   $0xffff,0x88(%eax)
801078b9:	ff ff 
801078bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801078be:	66 c7 80 8a 00 00 00 	movw   $0x0,0x8a(%eax)
801078c5:	00 00 
801078c7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801078ca:	c6 80 8c 00 00 00 00 	movb   $0x0,0x8c(%eax)
801078d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801078d4:	0f b6 90 8d 00 00 00 	movzbl 0x8d(%eax),%edx
801078db:	83 e2 f0             	and    $0xfffffff0,%edx
801078de:	83 ca 0a             	or     $0xa,%edx
801078e1:	88 90 8d 00 00 00    	mov    %dl,0x8d(%eax)
801078e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801078ea:	0f b6 90 8d 00 00 00 	movzbl 0x8d(%eax),%edx
801078f1:	83 ca 10             	or     $0x10,%edx
801078f4:	88 90 8d 00 00 00    	mov    %dl,0x8d(%eax)
801078fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801078fd:	0f b6 90 8d 00 00 00 	movzbl 0x8d(%eax),%edx
80107904:	83 ca 60             	or     $0x60,%edx
80107907:	88 90 8d 00 00 00    	mov    %dl,0x8d(%eax)
8010790d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107910:	0f b6 90 8d 00 00 00 	movzbl 0x8d(%eax),%edx
80107917:	83 ca 80             	or     $0xffffff80,%edx
8010791a:	88 90 8d 00 00 00    	mov    %dl,0x8d(%eax)
80107920:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107923:	0f b6 90 8e 00 00 00 	movzbl 0x8e(%eax),%edx
8010792a:	83 ca 0f             	or     $0xf,%edx
8010792d:	88 90 8e 00 00 00    	mov    %dl,0x8e(%eax)
80107933:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107936:	0f b6 90 8e 00 00 00 	movzbl 0x8e(%eax),%edx
8010793d:	83 e2 ef             	and    $0xffffffef,%edx
80107940:	88 90 8e 00 00 00    	mov    %dl,0x8e(%eax)
80107946:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107949:	0f b6 90 8e 00 00 00 	movzbl 0x8e(%eax),%edx
80107950:	83 e2 df             	and    $0xffffffdf,%edx
80107953:	88 90 8e 00 00 00    	mov    %dl,0x8e(%eax)
80107959:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010795c:	0f b6 90 8e 00 00 00 	movzbl 0x8e(%eax),%edx
80107963:	83 ca 40             	or     $0x40,%edx
80107966:	88 90 8e 00 00 00    	mov    %dl,0x8e(%eax)
8010796c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010796f:	0f b6 90 8e 00 00 00 	movzbl 0x8e(%eax),%edx
80107976:	83 ca 80             	or     $0xffffff80,%edx
80107979:	88 90 8e 00 00 00    	mov    %dl,0x8e(%eax)
8010797f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107982:	c6 80 8f 00 00 00 00 	movb   $0x0,0x8f(%eax)
  c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80107989:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010798c:	66 c7 80 90 00 00 00 	movw   $0xffff,0x90(%eax)
80107993:	ff ff 
80107995:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107998:	66 c7 80 92 00 00 00 	movw   $0x0,0x92(%eax)
8010799f:	00 00 
801079a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079a4:	c6 80 94 00 00 00 00 	movb   $0x0,0x94(%eax)
801079ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079ae:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801079b5:	83 e2 f0             	and    $0xfffffff0,%edx
801079b8:	83 ca 02             	or     $0x2,%edx
801079bb:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
801079c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079c4:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801079cb:	83 ca 10             	or     $0x10,%edx
801079ce:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
801079d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079d7:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801079de:	83 ca 60             	or     $0x60,%edx
801079e1:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
801079e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079ea:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801079f1:	83 ca 80             	or     $0xffffff80,%edx
801079f4:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
801079fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079fd:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107a04:	83 ca 0f             	or     $0xf,%edx
80107a07:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107a0d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a10:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107a17:	83 e2 ef             	and    $0xffffffef,%edx
80107a1a:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107a20:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a23:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107a2a:	83 e2 df             	and    $0xffffffdf,%edx
80107a2d:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107a33:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a36:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107a3d:	83 ca 40             	or     $0x40,%edx
80107a40:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107a46:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a49:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107a50:	83 ca 80             	or     $0xffffff80,%edx
80107a53:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107a59:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a5c:	c6 80 97 00 00 00 00 	movb   $0x0,0x97(%eax)
  lgdt(c->gdt, sizeof(c->gdt));
80107a63:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a66:	83 c0 70             	add    $0x70,%eax
80107a69:	83 ec 08             	sub    $0x8,%esp
80107a6c:	6a 30                	push   $0x30
80107a6e:	50                   	push   %eax
80107a6f:	e8 52 fc ff ff       	call   801076c6 <lgdt>
80107a74:	83 c4 10             	add    $0x10,%esp
}
80107a77:	90                   	nop
80107a78:	c9                   	leave  
80107a79:	c3                   	ret    

80107a7a <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va.  If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
80107a7a:	55                   	push   %ebp
80107a7b:	89 e5                	mov    %esp,%ebp
80107a7d:	83 ec 18             	sub    $0x18,%esp
  pde_t *pde;
  pte_t *pgtab;

  pde = &pgdir[PDX(va)];
80107a80:	8b 45 0c             	mov    0xc(%ebp),%eax
80107a83:	c1 e8 16             	shr    $0x16,%eax
80107a86:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80107a8d:	8b 45 08             	mov    0x8(%ebp),%eax
80107a90:	01 d0                	add    %edx,%eax
80107a92:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(*pde & PTE_P){
80107a95:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107a98:	8b 00                	mov    (%eax),%eax
80107a9a:	83 e0 01             	and    $0x1,%eax
80107a9d:	85 c0                	test   %eax,%eax
80107a9f:	74 14                	je     80107ab5 <walkpgdir+0x3b>
    pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
80107aa1:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107aa4:	8b 00                	mov    (%eax),%eax
80107aa6:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107aab:	05 00 00 00 80       	add    $0x80000000,%eax
80107ab0:	89 45 f4             	mov    %eax,-0xc(%ebp)
80107ab3:	eb 42                	jmp    80107af7 <walkpgdir+0x7d>
  } else {
    if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
80107ab5:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80107ab9:	74 0e                	je     80107ac9 <walkpgdir+0x4f>
80107abb:	e8 f6 b1 ff ff       	call   80102cb6 <kalloc>
80107ac0:	89 45 f4             	mov    %eax,-0xc(%ebp)
80107ac3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80107ac7:	75 07                	jne    80107ad0 <walkpgdir+0x56>
      return 0;
80107ac9:	b8 00 00 00 00       	mov    $0x0,%eax
80107ace:	eb 3e                	jmp    80107b0e <walkpgdir+0x94>
    // Make sure all those PTE_P bits are zero.
    memset(pgtab, 0, PGSIZE);
80107ad0:	83 ec 04             	sub    $0x4,%esp
80107ad3:	68 00 10 00 00       	push   $0x1000
80107ad8:	6a 00                	push   $0x0
80107ada:	ff 75 f4             	push   -0xc(%ebp)
80107add:	e8 4e d7 ff ff       	call   80105230 <memset>
80107ae2:	83 c4 10             	add    $0x10,%esp
    // The permissions here are overly generous, but they can
    // be further restricted by the permissions in the page table
    // entries, if necessary.
    *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
80107ae5:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107ae8:	05 00 00 00 80       	add    $0x80000000,%eax
80107aed:	83 c8 07             	or     $0x7,%eax
80107af0:	89 c2                	mov    %eax,%edx
80107af2:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107af5:	89 10                	mov    %edx,(%eax)
  }
  return &pgtab[PTX(va)];
80107af7:	8b 45 0c             	mov    0xc(%ebp),%eax
80107afa:	c1 e8 0c             	shr    $0xc,%eax
80107afd:	25 ff 03 00 00       	and    $0x3ff,%eax
80107b02:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80107b09:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b0c:	01 d0                	add    %edx,%eax
}
80107b0e:	c9                   	leave  
80107b0f:	c3                   	ret    

80107b10 <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
80107b10:	55                   	push   %ebp
80107b11:	89 e5                	mov    %esp,%ebp
80107b13:	83 ec 18             	sub    $0x18,%esp
  char *a, *last;
  pte_t *pte;

  a = (char*)PGROUNDDOWN((uint)va);
80107b16:	8b 45 0c             	mov    0xc(%ebp),%eax
80107b19:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107b1e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80107b21:	8b 55 0c             	mov    0xc(%ebp),%edx
80107b24:	8b 45 10             	mov    0x10(%ebp),%eax
80107b27:	01 d0                	add    %edx,%eax
80107b29:	83 e8 01             	sub    $0x1,%eax
80107b2c:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107b31:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(;;){
    if((pte = walkpgdir(pgdir, a, 1)) == 0)
80107b34:	83 ec 04             	sub    $0x4,%esp
80107b37:	6a 01                	push   $0x1
80107b39:	ff 75 f4             	push   -0xc(%ebp)
80107b3c:	ff 75 08             	push   0x8(%ebp)
80107b3f:	e8 36 ff ff ff       	call   80107a7a <walkpgdir>
80107b44:	83 c4 10             	add    $0x10,%esp
80107b47:	89 45 ec             	mov    %eax,-0x14(%ebp)
80107b4a:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80107b4e:	75 07                	jne    80107b57 <mappages+0x47>
      return -1;
80107b50:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107b55:	eb 47                	jmp    80107b9e <mappages+0x8e>
    if(*pte & PTE_P)
80107b57:	8b 45 ec             	mov    -0x14(%ebp),%eax
80107b5a:	8b 00                	mov    (%eax),%eax
80107b5c:	83 e0 01             	and    $0x1,%eax
80107b5f:	85 c0                	test   %eax,%eax
80107b61:	74 0d                	je     80107b70 <mappages+0x60>
      panic("remap");
80107b63:	83 ec 0c             	sub    $0xc,%esp
80107b66:	68 fc 8a 10 80       	push   $0x80108afc
80107b6b:	e8 45 8a ff ff       	call   801005b5 <panic>
    *pte = pa | perm | PTE_P;
80107b70:	8b 45 18             	mov    0x18(%ebp),%eax
80107b73:	0b 45 14             	or     0x14(%ebp),%eax
80107b76:	83 c8 01             	or     $0x1,%eax
80107b79:	89 c2                	mov    %eax,%edx
80107b7b:	8b 45 ec             	mov    -0x14(%ebp),%eax
80107b7e:	89 10                	mov    %edx,(%eax)
    if(a == last)
80107b80:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b83:	3b 45 f0             	cmp    -0x10(%ebp),%eax
80107b86:	74 10                	je     80107b98 <mappages+0x88>
      break;
    a += PGSIZE;
80107b88:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
    pa += PGSIZE;
80107b8f:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
    if((pte = walkpgdir(pgdir, a, 1)) == 0)
80107b96:	eb 9c                	jmp    80107b34 <mappages+0x24>
      break;
80107b98:	90                   	nop
  }
  return 0;
80107b99:	b8 00 00 00 00       	mov    $0x0,%eax
}
80107b9e:	c9                   	leave  
80107b9f:	c3                   	ret    

80107ba0 <setupkvm>:
};

// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
80107ba0:	55                   	push   %ebp
80107ba1:	89 e5                	mov    %esp,%ebp
80107ba3:	53                   	push   %ebx
80107ba4:	83 ec 14             	sub    $0x14,%esp
  pde_t *pgdir;
  struct kmap *k;

  if((pgdir = (pde_t*)kalloc()) == 0)
80107ba7:	e8 0a b1 ff ff       	call   80102cb6 <kalloc>
80107bac:	89 45 f0             	mov    %eax,-0x10(%ebp)
80107baf:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80107bb3:	75 07                	jne    80107bbc <setupkvm+0x1c>
    return 0;
80107bb5:	b8 00 00 00 00       	mov    $0x0,%eax
80107bba:	eb 78                	jmp    80107c34 <setupkvm+0x94>
  memset(pgdir, 0, PGSIZE);
80107bbc:	83 ec 04             	sub    $0x4,%esp
80107bbf:	68 00 10 00 00       	push   $0x1000
80107bc4:	6a 00                	push   $0x0
80107bc6:	ff 75 f0             	push   -0x10(%ebp)
80107bc9:	e8 62 d6 ff ff       	call   80105230 <memset>
80107bce:	83 c4 10             	add    $0x10,%esp
  if (P2V(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107bd1:	c7 45 f4 80 b4 10 80 	movl   $0x8010b480,-0xc(%ebp)
80107bd8:	eb 4e                	jmp    80107c28 <setupkvm+0x88>
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80107bda:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107bdd:	8b 48 0c             	mov    0xc(%eax),%ecx
                (uint)k->phys_start, k->perm) < 0) {
80107be0:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107be3:	8b 50 04             	mov    0x4(%eax),%edx
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80107be6:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107be9:	8b 58 08             	mov    0x8(%eax),%ebx
80107bec:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107bef:	8b 40 04             	mov    0x4(%eax),%eax
80107bf2:	29 c3                	sub    %eax,%ebx
80107bf4:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107bf7:	8b 00                	mov    (%eax),%eax
80107bf9:	83 ec 0c             	sub    $0xc,%esp
80107bfc:	51                   	push   %ecx
80107bfd:	52                   	push   %edx
80107bfe:	53                   	push   %ebx
80107bff:	50                   	push   %eax
80107c00:	ff 75 f0             	push   -0x10(%ebp)
80107c03:	e8 08 ff ff ff       	call   80107b10 <mappages>
80107c08:	83 c4 20             	add    $0x20,%esp
80107c0b:	85 c0                	test   %eax,%eax
80107c0d:	79 15                	jns    80107c24 <setupkvm+0x84>
      freevm(pgdir);
80107c0f:	83 ec 0c             	sub    $0xc,%esp
80107c12:	ff 75 f0             	push   -0x10(%ebp)
80107c15:	e8 f5 04 00 00       	call   8010810f <freevm>
80107c1a:	83 c4 10             	add    $0x10,%esp
      return 0;
80107c1d:	b8 00 00 00 00       	mov    $0x0,%eax
80107c22:	eb 10                	jmp    80107c34 <setupkvm+0x94>
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107c24:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
80107c28:	81 7d f4 c0 b4 10 80 	cmpl   $0x8010b4c0,-0xc(%ebp)
80107c2f:	72 a9                	jb     80107bda <setupkvm+0x3a>
    }
  return pgdir;
80107c31:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80107c34:	8b 5d fc             	mov    -0x4(%ebp),%ebx
80107c37:	c9                   	leave  
80107c38:	c3                   	ret    

80107c39 <kvmalloc>:

// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
80107c39:	55                   	push   %ebp
80107c3a:	89 e5                	mov    %esp,%ebp
80107c3c:	83 ec 08             	sub    $0x8,%esp
  kpgdir = setupkvm();
80107c3f:	e8 5c ff ff ff       	call   80107ba0 <setupkvm>
80107c44:	a3 fc 54 11 80       	mov    %eax,0x801154fc
  switchkvm();
80107c49:	e8 03 00 00 00       	call   80107c51 <switchkvm>
}
80107c4e:	90                   	nop
80107c4f:	c9                   	leave  
80107c50:	c3                   	ret    

80107c51 <switchkvm>:

// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80107c51:	55                   	push   %ebp
80107c52:	89 e5                	mov    %esp,%ebp
  lcr3(V2P(kpgdir));   // switch to the kernel page table
80107c54:	a1 fc 54 11 80       	mov    0x801154fc,%eax
80107c59:	05 00 00 00 80       	add    $0x80000000,%eax
80107c5e:	50                   	push   %eax
80107c5f:	e8 b4 fa ff ff       	call   80107718 <lcr3>
80107c64:	83 c4 04             	add    $0x4,%esp
}
80107c67:	90                   	nop
80107c68:	c9                   	leave  
80107c69:	c3                   	ret    

80107c6a <switchuvm>:

// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80107c6a:	55                   	push   %ebp
80107c6b:	89 e5                	mov    %esp,%ebp
80107c6d:	56                   	push   %esi
80107c6e:	53                   	push   %ebx
80107c6f:	83 ec 10             	sub    $0x10,%esp
  if(p == 0)
80107c72:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80107c76:	75 0d                	jne    80107c85 <switchuvm+0x1b>
    panic("switchuvm: no process");
80107c78:	83 ec 0c             	sub    $0xc,%esp
80107c7b:	68 02 8b 10 80       	push   $0x80108b02
80107c80:	e8 30 89 ff ff       	call   801005b5 <panic>
  if(p->kstack == 0)
80107c85:	8b 45 08             	mov    0x8(%ebp),%eax
80107c88:	8b 40 08             	mov    0x8(%eax),%eax
80107c8b:	85 c0                	test   %eax,%eax
80107c8d:	75 0d                	jne    80107c9c <switchuvm+0x32>
    panic("switchuvm: no kstack");
80107c8f:	83 ec 0c             	sub    $0xc,%esp
80107c92:	68 18 8b 10 80       	push   $0x80108b18
80107c97:	e8 19 89 ff ff       	call   801005b5 <panic>
  if(p->pgdir == 0)
80107c9c:	8b 45 08             	mov    0x8(%ebp),%eax
80107c9f:	8b 40 04             	mov    0x4(%eax),%eax
80107ca2:	85 c0                	test   %eax,%eax
80107ca4:	75 0d                	jne    80107cb3 <switchuvm+0x49>
    panic("switchuvm: no pgdir");
80107ca6:	83 ec 0c             	sub    $0xc,%esp
80107ca9:	68 2d 8b 10 80       	push   $0x80108b2d
80107cae:	e8 02 89 ff ff       	call   801005b5 <panic>

  pushcli();
80107cb3:	e8 6d d4 ff ff       	call   80105125 <pushcli>
  mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts,
80107cb8:	e8 a7 c5 ff ff       	call   80104264 <mycpu>
80107cbd:	89 c3                	mov    %eax,%ebx
80107cbf:	e8 a0 c5 ff ff       	call   80104264 <mycpu>
80107cc4:	83 c0 08             	add    $0x8,%eax
80107cc7:	89 c6                	mov    %eax,%esi
80107cc9:	e8 96 c5 ff ff       	call   80104264 <mycpu>
80107cce:	83 c0 08             	add    $0x8,%eax
80107cd1:	c1 e8 10             	shr    $0x10,%eax
80107cd4:	88 45 f7             	mov    %al,-0x9(%ebp)
80107cd7:	e8 88 c5 ff ff       	call   80104264 <mycpu>
80107cdc:	83 c0 08             	add    $0x8,%eax
80107cdf:	c1 e8 18             	shr    $0x18,%eax
80107ce2:	89 c2                	mov    %eax,%edx
80107ce4:	66 c7 83 98 00 00 00 	movw   $0x67,0x98(%ebx)
80107ceb:	67 00 
80107ced:	66 89 b3 9a 00 00 00 	mov    %si,0x9a(%ebx)
80107cf4:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
80107cf8:	88 83 9c 00 00 00    	mov    %al,0x9c(%ebx)
80107cfe:	0f b6 83 9d 00 00 00 	movzbl 0x9d(%ebx),%eax
80107d05:	83 e0 f0             	and    $0xfffffff0,%eax
80107d08:	83 c8 09             	or     $0x9,%eax
80107d0b:	88 83 9d 00 00 00    	mov    %al,0x9d(%ebx)
80107d11:	0f b6 83 9d 00 00 00 	movzbl 0x9d(%ebx),%eax
80107d18:	83 c8 10             	or     $0x10,%eax
80107d1b:	88 83 9d 00 00 00    	mov    %al,0x9d(%ebx)
80107d21:	0f b6 83 9d 00 00 00 	movzbl 0x9d(%ebx),%eax
80107d28:	83 e0 9f             	and    $0xffffff9f,%eax
80107d2b:	88 83 9d 00 00 00    	mov    %al,0x9d(%ebx)
80107d31:	0f b6 83 9d 00 00 00 	movzbl 0x9d(%ebx),%eax
80107d38:	83 c8 80             	or     $0xffffff80,%eax
80107d3b:	88 83 9d 00 00 00    	mov    %al,0x9d(%ebx)
80107d41:	0f b6 83 9e 00 00 00 	movzbl 0x9e(%ebx),%eax
80107d48:	83 e0 f0             	and    $0xfffffff0,%eax
80107d4b:	88 83 9e 00 00 00    	mov    %al,0x9e(%ebx)
80107d51:	0f b6 83 9e 00 00 00 	movzbl 0x9e(%ebx),%eax
80107d58:	83 e0 ef             	and    $0xffffffef,%eax
80107d5b:	88 83 9e 00 00 00    	mov    %al,0x9e(%ebx)
80107d61:	0f b6 83 9e 00 00 00 	movzbl 0x9e(%ebx),%eax
80107d68:	83 e0 df             	and    $0xffffffdf,%eax
80107d6b:	88 83 9e 00 00 00    	mov    %al,0x9e(%ebx)
80107d71:	0f b6 83 9e 00 00 00 	movzbl 0x9e(%ebx),%eax
80107d78:	83 c8 40             	or     $0x40,%eax
80107d7b:	88 83 9e 00 00 00    	mov    %al,0x9e(%ebx)
80107d81:	0f b6 83 9e 00 00 00 	movzbl 0x9e(%ebx),%eax
80107d88:	83 e0 7f             	and    $0x7f,%eax
80107d8b:	88 83 9e 00 00 00    	mov    %al,0x9e(%ebx)
80107d91:	88 93 9f 00 00 00    	mov    %dl,0x9f(%ebx)
                                sizeof(mycpu()->ts)-1, 0);
  mycpu()->gdt[SEG_TSS].s = 0;
80107d97:	e8 c8 c4 ff ff       	call   80104264 <mycpu>
80107d9c:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
80107da3:	83 e2 ef             	and    $0xffffffef,%edx
80107da6:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
  mycpu()->ts.ss0 = SEG_KDATA << 3;
80107dac:	e8 b3 c4 ff ff       	call   80104264 <mycpu>
80107db1:	66 c7 40 10 10 00    	movw   $0x10,0x10(%eax)
  mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
80107db7:	8b 45 08             	mov    0x8(%ebp),%eax
80107dba:	8b 40 08             	mov    0x8(%eax),%eax
80107dbd:	89 c3                	mov    %eax,%ebx
80107dbf:	e8 a0 c4 ff ff       	call   80104264 <mycpu>
80107dc4:	8d 93 00 10 00 00    	lea    0x1000(%ebx),%edx
80107dca:	89 50 0c             	mov    %edx,0xc(%eax)
  // setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
  // forbids I/O instructions (e.g., inb and outb) from user space
  mycpu()->ts.iomb = (ushort) 0xFFFF;
80107dcd:	e8 92 c4 ff ff       	call   80104264 <mycpu>
80107dd2:	66 c7 40 6e ff ff    	movw   $0xffff,0x6e(%eax)
  ltr(SEG_TSS << 3);
80107dd8:	83 ec 0c             	sub    $0xc,%esp
80107ddb:	6a 28                	push   $0x28
80107ddd:	e8 0e f9 ff ff       	call   801076f0 <ltr>
80107de2:	83 c4 10             	add    $0x10,%esp
  lcr3(V2P(p->pgdir));  // switch to process's address space
80107de5:	8b 45 08             	mov    0x8(%ebp),%eax
80107de8:	8b 40 04             	mov    0x4(%eax),%eax
80107deb:	05 00 00 00 80       	add    $0x80000000,%eax
80107df0:	83 ec 0c             	sub    $0xc,%esp
80107df3:	50                   	push   %eax
80107df4:	e8 1f f9 ff ff       	call   80107718 <lcr3>
80107df9:	83 c4 10             	add    $0x10,%esp
  popcli();
80107dfc:	e8 71 d3 ff ff       	call   80105172 <popcli>
}
80107e01:	90                   	nop
80107e02:	8d 65 f8             	lea    -0x8(%ebp),%esp
80107e05:	5b                   	pop    %ebx
80107e06:	5e                   	pop    %esi
80107e07:	5d                   	pop    %ebp
80107e08:	c3                   	ret    

80107e09 <inituvm>:

// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80107e09:	55                   	push   %ebp
80107e0a:	89 e5                	mov    %esp,%ebp
80107e0c:	83 ec 18             	sub    $0x18,%esp
  char *mem;

  if(sz >= PGSIZE)
80107e0f:	81 7d 10 ff 0f 00 00 	cmpl   $0xfff,0x10(%ebp)
80107e16:	76 0d                	jbe    80107e25 <inituvm+0x1c>
    panic("inituvm: more than a page");
80107e18:	83 ec 0c             	sub    $0xc,%esp
80107e1b:	68 41 8b 10 80       	push   $0x80108b41
80107e20:	e8 90 87 ff ff       	call   801005b5 <panic>
  mem = kalloc();
80107e25:	e8 8c ae ff ff       	call   80102cb6 <kalloc>
80107e2a:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memset(mem, 0, PGSIZE);
80107e2d:	83 ec 04             	sub    $0x4,%esp
80107e30:	68 00 10 00 00       	push   $0x1000
80107e35:	6a 00                	push   $0x0
80107e37:	ff 75 f4             	push   -0xc(%ebp)
80107e3a:	e8 f1 d3 ff ff       	call   80105230 <memset>
80107e3f:	83 c4 10             	add    $0x10,%esp
  mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
80107e42:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107e45:	05 00 00 00 80       	add    $0x80000000,%eax
80107e4a:	83 ec 0c             	sub    $0xc,%esp
80107e4d:	6a 06                	push   $0x6
80107e4f:	50                   	push   %eax
80107e50:	68 00 10 00 00       	push   $0x1000
80107e55:	6a 00                	push   $0x0
80107e57:	ff 75 08             	push   0x8(%ebp)
80107e5a:	e8 b1 fc ff ff       	call   80107b10 <mappages>
80107e5f:	83 c4 20             	add    $0x20,%esp
  memmove(mem, init, sz);
80107e62:	83 ec 04             	sub    $0x4,%esp
80107e65:	ff 75 10             	push   0x10(%ebp)
80107e68:	ff 75 0c             	push   0xc(%ebp)
80107e6b:	ff 75 f4             	push   -0xc(%ebp)
80107e6e:	e8 7c d4 ff ff       	call   801052ef <memmove>
80107e73:	83 c4 10             	add    $0x10,%esp
}
80107e76:	90                   	nop
80107e77:	c9                   	leave  
80107e78:	c3                   	ret    

80107e79 <loaduvm>:

// Load a program segment into pgdir.  addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
80107e79:	55                   	push   %ebp
80107e7a:	89 e5                	mov    %esp,%ebp
80107e7c:	83 ec 18             	sub    $0x18,%esp
  uint i, pa, n;
  pte_t *pte;

  if((uint) addr % PGSIZE != 0)
80107e7f:	8b 45 0c             	mov    0xc(%ebp),%eax
80107e82:	25 ff 0f 00 00       	and    $0xfff,%eax
80107e87:	85 c0                	test   %eax,%eax
80107e89:	74 0d                	je     80107e98 <loaduvm+0x1f>
    panic("loaduvm: addr must be page aligned");
80107e8b:	83 ec 0c             	sub    $0xc,%esp
80107e8e:	68 5c 8b 10 80       	push   $0x80108b5c
80107e93:	e8 1d 87 ff ff       	call   801005b5 <panic>
  for(i = 0; i < sz; i += PGSIZE){
80107e98:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80107e9f:	e9 8f 00 00 00       	jmp    80107f33 <loaduvm+0xba>
    if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80107ea4:	8b 55 0c             	mov    0xc(%ebp),%edx
80107ea7:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107eaa:	01 d0                	add    %edx,%eax
80107eac:	83 ec 04             	sub    $0x4,%esp
80107eaf:	6a 00                	push   $0x0
80107eb1:	50                   	push   %eax
80107eb2:	ff 75 08             	push   0x8(%ebp)
80107eb5:	e8 c0 fb ff ff       	call   80107a7a <walkpgdir>
80107eba:	83 c4 10             	add    $0x10,%esp
80107ebd:	89 45 ec             	mov    %eax,-0x14(%ebp)
80107ec0:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80107ec4:	75 0d                	jne    80107ed3 <loaduvm+0x5a>
      panic("loaduvm: address should exist");
80107ec6:	83 ec 0c             	sub    $0xc,%esp
80107ec9:	68 7f 8b 10 80       	push   $0x80108b7f
80107ece:	e8 e2 86 ff ff       	call   801005b5 <panic>
    pa = PTE_ADDR(*pte);
80107ed3:	8b 45 ec             	mov    -0x14(%ebp),%eax
80107ed6:	8b 00                	mov    (%eax),%eax
80107ed8:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107edd:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if(sz - i < PGSIZE)
80107ee0:	8b 45 18             	mov    0x18(%ebp),%eax
80107ee3:	2b 45 f4             	sub    -0xc(%ebp),%eax
80107ee6:	3d ff 0f 00 00       	cmp    $0xfff,%eax
80107eeb:	77 0b                	ja     80107ef8 <loaduvm+0x7f>
      n = sz - i;
80107eed:	8b 45 18             	mov    0x18(%ebp),%eax
80107ef0:	2b 45 f4             	sub    -0xc(%ebp),%eax
80107ef3:	89 45 f0             	mov    %eax,-0x10(%ebp)
80107ef6:	eb 07                	jmp    80107eff <loaduvm+0x86>
    else
      n = PGSIZE;
80107ef8:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
    if(readi(ip, P2V(pa), offset+i, n) != n)
80107eff:	8b 55 14             	mov    0x14(%ebp),%edx
80107f02:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107f05:	01 d0                	add    %edx,%eax
80107f07:	8b 55 e8             	mov    -0x18(%ebp),%edx
80107f0a:	81 c2 00 00 00 80    	add    $0x80000000,%edx
80107f10:	ff 75 f0             	push   -0x10(%ebp)
80107f13:	50                   	push   %eax
80107f14:	52                   	push   %edx
80107f15:	ff 75 10             	push   0x10(%ebp)
80107f18:	e8 fc 9f ff ff       	call   80101f19 <readi>
80107f1d:	83 c4 10             	add    $0x10,%esp
80107f20:	39 45 f0             	cmp    %eax,-0x10(%ebp)
80107f23:	74 07                	je     80107f2c <loaduvm+0xb3>
      return -1;
80107f25:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107f2a:	eb 18                	jmp    80107f44 <loaduvm+0xcb>
  for(i = 0; i < sz; i += PGSIZE){
80107f2c:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80107f33:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107f36:	3b 45 18             	cmp    0x18(%ebp),%eax
80107f39:	0f 82 65 ff ff ff    	jb     80107ea4 <loaduvm+0x2b>
  }
  return 0;
80107f3f:	b8 00 00 00 00       	mov    $0x0,%eax
}
80107f44:	c9                   	leave  
80107f45:	c3                   	ret    

80107f46 <allocuvm>:

// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned.  Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80107f46:	55                   	push   %ebp
80107f47:	89 e5                	mov    %esp,%ebp
80107f49:	83 ec 18             	sub    $0x18,%esp
  char *mem;
  uint a;

  if(newsz >= KERNBASE)
80107f4c:	8b 45 10             	mov    0x10(%ebp),%eax
80107f4f:	85 c0                	test   %eax,%eax
80107f51:	79 0a                	jns    80107f5d <allocuvm+0x17>
    return 0;
80107f53:	b8 00 00 00 00       	mov    $0x0,%eax
80107f58:	e9 ec 00 00 00       	jmp    80108049 <allocuvm+0x103>
  if(newsz < oldsz)
80107f5d:	8b 45 10             	mov    0x10(%ebp),%eax
80107f60:	3b 45 0c             	cmp    0xc(%ebp),%eax
80107f63:	73 08                	jae    80107f6d <allocuvm+0x27>
    return oldsz;
80107f65:	8b 45 0c             	mov    0xc(%ebp),%eax
80107f68:	e9 dc 00 00 00       	jmp    80108049 <allocuvm+0x103>

  a = PGROUNDUP(oldsz);
80107f6d:	8b 45 0c             	mov    0xc(%ebp),%eax
80107f70:	05 ff 0f 00 00       	add    $0xfff,%eax
80107f75:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107f7a:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; a < newsz; a += PGSIZE){
80107f7d:	e9 b8 00 00 00       	jmp    8010803a <allocuvm+0xf4>
    mem = kalloc();
80107f82:	e8 2f ad ff ff       	call   80102cb6 <kalloc>
80107f87:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(mem == 0){
80107f8a:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80107f8e:	75 2e                	jne    80107fbe <allocuvm+0x78>
      cprintf("allocuvm out of memory\n");
80107f90:	83 ec 0c             	sub    $0xc,%esp
80107f93:	68 9d 8b 10 80       	push   $0x80108b9d
80107f98:	e8 63 84 ff ff       	call   80100400 <cprintf>
80107f9d:	83 c4 10             	add    $0x10,%esp
      deallocuvm(pgdir, newsz, oldsz);
80107fa0:	83 ec 04             	sub    $0x4,%esp
80107fa3:	ff 75 0c             	push   0xc(%ebp)
80107fa6:	ff 75 10             	push   0x10(%ebp)
80107fa9:	ff 75 08             	push   0x8(%ebp)
80107fac:	e8 9a 00 00 00       	call   8010804b <deallocuvm>
80107fb1:	83 c4 10             	add    $0x10,%esp
      return 0;
80107fb4:	b8 00 00 00 00       	mov    $0x0,%eax
80107fb9:	e9 8b 00 00 00       	jmp    80108049 <allocuvm+0x103>
    }
    memset(mem, 0, PGSIZE);
80107fbe:	83 ec 04             	sub    $0x4,%esp
80107fc1:	68 00 10 00 00       	push   $0x1000
80107fc6:	6a 00                	push   $0x0
80107fc8:	ff 75 f0             	push   -0x10(%ebp)
80107fcb:	e8 60 d2 ff ff       	call   80105230 <memset>
80107fd0:	83 c4 10             	add    $0x10,%esp
    if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
80107fd3:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107fd6:	8d 90 00 00 00 80    	lea    -0x80000000(%eax),%edx
80107fdc:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107fdf:	83 ec 0c             	sub    $0xc,%esp
80107fe2:	6a 06                	push   $0x6
80107fe4:	52                   	push   %edx
80107fe5:	68 00 10 00 00       	push   $0x1000
80107fea:	50                   	push   %eax
80107feb:	ff 75 08             	push   0x8(%ebp)
80107fee:	e8 1d fb ff ff       	call   80107b10 <mappages>
80107ff3:	83 c4 20             	add    $0x20,%esp
80107ff6:	85 c0                	test   %eax,%eax
80107ff8:	79 39                	jns    80108033 <allocuvm+0xed>
      cprintf("allocuvm out of memory (2)\n");
80107ffa:	83 ec 0c             	sub    $0xc,%esp
80107ffd:	68 b5 8b 10 80       	push   $0x80108bb5
80108002:	e8 f9 83 ff ff       	call   80100400 <cprintf>
80108007:	83 c4 10             	add    $0x10,%esp
      deallocuvm(pgdir, newsz, oldsz);
8010800a:	83 ec 04             	sub    $0x4,%esp
8010800d:	ff 75 0c             	push   0xc(%ebp)
80108010:	ff 75 10             	push   0x10(%ebp)
80108013:	ff 75 08             	push   0x8(%ebp)
80108016:	e8 30 00 00 00       	call   8010804b <deallocuvm>
8010801b:	83 c4 10             	add    $0x10,%esp
      kfree(mem);
8010801e:	83 ec 0c             	sub    $0xc,%esp
80108021:	ff 75 f0             	push   -0x10(%ebp)
80108024:	e8 e6 ab ff ff       	call   80102c0f <kfree>
80108029:	83 c4 10             	add    $0x10,%esp
      return 0;
8010802c:	b8 00 00 00 00       	mov    $0x0,%eax
80108031:	eb 16                	jmp    80108049 <allocuvm+0x103>
  for(; a < newsz; a += PGSIZE){
80108033:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
8010803a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010803d:	3b 45 10             	cmp    0x10(%ebp),%eax
80108040:	0f 82 3c ff ff ff    	jb     80107f82 <allocuvm+0x3c>
    }
  }
  return newsz;
80108046:	8b 45 10             	mov    0x10(%ebp),%eax
}
80108049:	c9                   	leave  
8010804a:	c3                   	ret    

8010804b <deallocuvm>:
// newsz.  oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz.  oldsz can be larger than the actual
// process size.  Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
8010804b:	55                   	push   %ebp
8010804c:	89 e5                	mov    %esp,%ebp
8010804e:	83 ec 18             	sub    $0x18,%esp
  pte_t *pte;
  uint a, pa;

  if(newsz >= oldsz)
80108051:	8b 45 10             	mov    0x10(%ebp),%eax
80108054:	3b 45 0c             	cmp    0xc(%ebp),%eax
80108057:	72 08                	jb     80108061 <deallocuvm+0x16>
    return oldsz;
80108059:	8b 45 0c             	mov    0xc(%ebp),%eax
8010805c:	e9 ac 00 00 00       	jmp    8010810d <deallocuvm+0xc2>

  a = PGROUNDUP(newsz);
80108061:	8b 45 10             	mov    0x10(%ebp),%eax
80108064:	05 ff 0f 00 00       	add    $0xfff,%eax
80108069:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010806e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; a  < oldsz; a += PGSIZE){
80108071:	e9 88 00 00 00       	jmp    801080fe <deallocuvm+0xb3>
    pte = walkpgdir(pgdir, (char*)a, 0);
80108076:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108079:	83 ec 04             	sub    $0x4,%esp
8010807c:	6a 00                	push   $0x0
8010807e:	50                   	push   %eax
8010807f:	ff 75 08             	push   0x8(%ebp)
80108082:	e8 f3 f9 ff ff       	call   80107a7a <walkpgdir>
80108087:	83 c4 10             	add    $0x10,%esp
8010808a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(!pte)
8010808d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80108091:	75 16                	jne    801080a9 <deallocuvm+0x5e>
      a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
80108093:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108096:	c1 e8 16             	shr    $0x16,%eax
80108099:	83 c0 01             	add    $0x1,%eax
8010809c:	c1 e0 16             	shl    $0x16,%eax
8010809f:	2d 00 10 00 00       	sub    $0x1000,%eax
801080a4:	89 45 f4             	mov    %eax,-0xc(%ebp)
801080a7:	eb 4e                	jmp    801080f7 <deallocuvm+0xac>
    else if((*pte & PTE_P) != 0){
801080a9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801080ac:	8b 00                	mov    (%eax),%eax
801080ae:	83 e0 01             	and    $0x1,%eax
801080b1:	85 c0                	test   %eax,%eax
801080b3:	74 42                	je     801080f7 <deallocuvm+0xac>
      pa = PTE_ADDR(*pte);
801080b5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801080b8:	8b 00                	mov    (%eax),%eax
801080ba:	25 00 f0 ff ff       	and    $0xfffff000,%eax
801080bf:	89 45 ec             	mov    %eax,-0x14(%ebp)
      if(pa == 0)
801080c2:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
801080c6:	75 0d                	jne    801080d5 <deallocuvm+0x8a>
        panic("kfree");
801080c8:	83 ec 0c             	sub    $0xc,%esp
801080cb:	68 d1 8b 10 80       	push   $0x80108bd1
801080d0:	e8 e0 84 ff ff       	call   801005b5 <panic>
      char *v = P2V(pa);
801080d5:	8b 45 ec             	mov    -0x14(%ebp),%eax
801080d8:	05 00 00 00 80       	add    $0x80000000,%eax
801080dd:	89 45 e8             	mov    %eax,-0x18(%ebp)
      kfree(v);
801080e0:	83 ec 0c             	sub    $0xc,%esp
801080e3:	ff 75 e8             	push   -0x18(%ebp)
801080e6:	e8 24 ab ff ff       	call   80102c0f <kfree>
801080eb:	83 c4 10             	add    $0x10,%esp
      *pte = 0;
801080ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
801080f1:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  for(; a  < oldsz; a += PGSIZE){
801080f7:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801080fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108101:	3b 45 0c             	cmp    0xc(%ebp),%eax
80108104:	0f 82 6c ff ff ff    	jb     80108076 <deallocuvm+0x2b>
    }
  }
  return newsz;
8010810a:	8b 45 10             	mov    0x10(%ebp),%eax
}
8010810d:	c9                   	leave  
8010810e:	c3                   	ret    

8010810f <freevm>:

// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
8010810f:	55                   	push   %ebp
80108110:	89 e5                	mov    %esp,%ebp
80108112:	83 ec 18             	sub    $0x18,%esp
  uint i;

  if(pgdir == 0)
80108115:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80108119:	75 0d                	jne    80108128 <freevm+0x19>
    panic("freevm: no pgdir");
8010811b:	83 ec 0c             	sub    $0xc,%esp
8010811e:	68 d7 8b 10 80       	push   $0x80108bd7
80108123:	e8 8d 84 ff ff       	call   801005b5 <panic>
  deallocuvm(pgdir, KERNBASE, 0);
80108128:	83 ec 04             	sub    $0x4,%esp
8010812b:	6a 00                	push   $0x0
8010812d:	68 00 00 00 80       	push   $0x80000000
80108132:	ff 75 08             	push   0x8(%ebp)
80108135:	e8 11 ff ff ff       	call   8010804b <deallocuvm>
8010813a:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i < NPDENTRIES; i++){
8010813d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80108144:	eb 48                	jmp    8010818e <freevm+0x7f>
    if(pgdir[i] & PTE_P){
80108146:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108149:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80108150:	8b 45 08             	mov    0x8(%ebp),%eax
80108153:	01 d0                	add    %edx,%eax
80108155:	8b 00                	mov    (%eax),%eax
80108157:	83 e0 01             	and    $0x1,%eax
8010815a:	85 c0                	test   %eax,%eax
8010815c:	74 2c                	je     8010818a <freevm+0x7b>
      char * v = P2V(PTE_ADDR(pgdir[i]));
8010815e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108161:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80108168:	8b 45 08             	mov    0x8(%ebp),%eax
8010816b:	01 d0                	add    %edx,%eax
8010816d:	8b 00                	mov    (%eax),%eax
8010816f:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108174:	05 00 00 00 80       	add    $0x80000000,%eax
80108179:	89 45 f0             	mov    %eax,-0x10(%ebp)
      kfree(v);
8010817c:	83 ec 0c             	sub    $0xc,%esp
8010817f:	ff 75 f0             	push   -0x10(%ebp)
80108182:	e8 88 aa ff ff       	call   80102c0f <kfree>
80108187:	83 c4 10             	add    $0x10,%esp
  for(i = 0; i < NPDENTRIES; i++){
8010818a:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010818e:	81 7d f4 ff 03 00 00 	cmpl   $0x3ff,-0xc(%ebp)
80108195:	76 af                	jbe    80108146 <freevm+0x37>
    }
  }
  kfree((char*)pgdir);
80108197:	83 ec 0c             	sub    $0xc,%esp
8010819a:	ff 75 08             	push   0x8(%ebp)
8010819d:	e8 6d aa ff ff       	call   80102c0f <kfree>
801081a2:	83 c4 10             	add    $0x10,%esp
}
801081a5:	90                   	nop
801081a6:	c9                   	leave  
801081a7:	c3                   	ret    

801081a8 <clearpteu>:

// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
801081a8:	55                   	push   %ebp
801081a9:	89 e5                	mov    %esp,%ebp
801081ab:	83 ec 18             	sub    $0x18,%esp
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
801081ae:	83 ec 04             	sub    $0x4,%esp
801081b1:	6a 00                	push   $0x0
801081b3:	ff 75 0c             	push   0xc(%ebp)
801081b6:	ff 75 08             	push   0x8(%ebp)
801081b9:	e8 bc f8 ff ff       	call   80107a7a <walkpgdir>
801081be:	83 c4 10             	add    $0x10,%esp
801081c1:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(pte == 0)
801081c4:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801081c8:	75 0d                	jne    801081d7 <clearpteu+0x2f>
    panic("clearpteu");
801081ca:	83 ec 0c             	sub    $0xc,%esp
801081cd:	68 e8 8b 10 80       	push   $0x80108be8
801081d2:	e8 de 83 ff ff       	call   801005b5 <panic>
  *pte &= ~PTE_U;
801081d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801081da:	8b 00                	mov    (%eax),%eax
801081dc:	83 e0 fb             	and    $0xfffffffb,%eax
801081df:	89 c2                	mov    %eax,%edx
801081e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801081e4:	89 10                	mov    %edx,(%eax)
}
801081e6:	90                   	nop
801081e7:	c9                   	leave  
801081e8:	c3                   	ret    

801081e9 <copyuvm>:

// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
801081e9:	55                   	push   %ebp
801081ea:	89 e5                	mov    %esp,%ebp
801081ec:	83 ec 28             	sub    $0x28,%esp
  pde_t *d;
  pte_t *pte;
  uint pa, i, flags;
  char *mem;

  if((d = setupkvm()) == 0)
801081ef:	e8 ac f9 ff ff       	call   80107ba0 <setupkvm>
801081f4:	89 45 f0             	mov    %eax,-0x10(%ebp)
801081f7:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801081fb:	75 0a                	jne    80108207 <copyuvm+0x1e>
    return 0;
801081fd:	b8 00 00 00 00       	mov    $0x0,%eax
80108202:	e9 e1 00 00 00       	jmp    801082e8 <copyuvm+0xff>
  for(i = 0; i < sz; i += PGSIZE){
80108207:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010820e:	e9 ad 00 00 00       	jmp    801082c0 <copyuvm+0xd7>
    if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80108213:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108216:	83 ec 04             	sub    $0x4,%esp
80108219:	6a 00                	push   $0x0
8010821b:	50                   	push   %eax
8010821c:	ff 75 08             	push   0x8(%ebp)
8010821f:	e8 56 f8 ff ff       	call   80107a7a <walkpgdir>
80108224:	83 c4 10             	add    $0x10,%esp
80108227:	89 45 ec             	mov    %eax,-0x14(%ebp)
8010822a:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
8010822e:	75 0d                	jne    8010823d <copyuvm+0x54>
      panic("copyuvm: pte should exist");
80108230:	83 ec 0c             	sub    $0xc,%esp
80108233:	68 f2 8b 10 80       	push   $0x80108bf2
80108238:	e8 78 83 ff ff       	call   801005b5 <panic>
    if(!(*pte & PTE_P))
8010823d:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108240:	8b 00                	mov    (%eax),%eax
80108242:	83 e0 01             	and    $0x1,%eax
80108245:	85 c0                	test   %eax,%eax
80108247:	74 6f                	je     801082b8 <copyuvm+0xcf>
      // panic("copyuvm: page not present");
      continue;
    pa = PTE_ADDR(*pte);
80108249:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010824c:	8b 00                	mov    (%eax),%eax
8010824e:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108253:	89 45 e8             	mov    %eax,-0x18(%ebp)
    flags = PTE_FLAGS(*pte);
80108256:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108259:	8b 00                	mov    (%eax),%eax
8010825b:	25 ff 0f 00 00       	and    $0xfff,%eax
80108260:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    if((mem = kalloc()) == 0)
80108263:	e8 4e aa ff ff       	call   80102cb6 <kalloc>
80108268:	89 45 e0             	mov    %eax,-0x20(%ebp)
8010826b:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
8010826f:	74 60                	je     801082d1 <copyuvm+0xe8>
      goto bad;
    memmove(mem, (char*)P2V(pa), PGSIZE);
80108271:	8b 45 e8             	mov    -0x18(%ebp),%eax
80108274:	05 00 00 00 80       	add    $0x80000000,%eax
80108279:	83 ec 04             	sub    $0x4,%esp
8010827c:	68 00 10 00 00       	push   $0x1000
80108281:	50                   	push   %eax
80108282:	ff 75 e0             	push   -0x20(%ebp)
80108285:	e8 65 d0 ff ff       	call   801052ef <memmove>
8010828a:	83 c4 10             	add    $0x10,%esp
    if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0)
8010828d:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80108290:	8b 45 e0             	mov    -0x20(%ebp),%eax
80108293:	8d 88 00 00 00 80    	lea    -0x80000000(%eax),%ecx
80108299:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010829c:	83 ec 0c             	sub    $0xc,%esp
8010829f:	52                   	push   %edx
801082a0:	51                   	push   %ecx
801082a1:	68 00 10 00 00       	push   $0x1000
801082a6:	50                   	push   %eax
801082a7:	ff 75 f0             	push   -0x10(%ebp)
801082aa:	e8 61 f8 ff ff       	call   80107b10 <mappages>
801082af:	83 c4 20             	add    $0x20,%esp
801082b2:	85 c0                	test   %eax,%eax
801082b4:	78 1e                	js     801082d4 <copyuvm+0xeb>
801082b6:	eb 01                	jmp    801082b9 <copyuvm+0xd0>
      continue;
801082b8:	90                   	nop
  for(i = 0; i < sz; i += PGSIZE){
801082b9:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801082c0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801082c3:	3b 45 0c             	cmp    0xc(%ebp),%eax
801082c6:	0f 82 47 ff ff ff    	jb     80108213 <copyuvm+0x2a>
      goto bad;
  }
  return d;
801082cc:	8b 45 f0             	mov    -0x10(%ebp),%eax
801082cf:	eb 17                	jmp    801082e8 <copyuvm+0xff>
      goto bad;
801082d1:	90                   	nop
801082d2:	eb 01                	jmp    801082d5 <copyuvm+0xec>
      goto bad;
801082d4:	90                   	nop

bad:
  freevm(d);
801082d5:	83 ec 0c             	sub    $0xc,%esp
801082d8:	ff 75 f0             	push   -0x10(%ebp)
801082db:	e8 2f fe ff ff       	call   8010810f <freevm>
801082e0:	83 c4 10             	add    $0x10,%esp
  return 0;
801082e3:	b8 00 00 00 00       	mov    $0x0,%eax
}
801082e8:	c9                   	leave  
801082e9:	c3                   	ret    

801082ea <uva2ka>:

//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
801082ea:	55                   	push   %ebp
801082eb:	89 e5                	mov    %esp,%ebp
801082ed:	83 ec 18             	sub    $0x18,%esp
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
801082f0:	83 ec 04             	sub    $0x4,%esp
801082f3:	6a 00                	push   $0x0
801082f5:	ff 75 0c             	push   0xc(%ebp)
801082f8:	ff 75 08             	push   0x8(%ebp)
801082fb:	e8 7a f7 ff ff       	call   80107a7a <walkpgdir>
80108300:	83 c4 10             	add    $0x10,%esp
80108303:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((*pte & PTE_P) == 0)
80108306:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108309:	8b 00                	mov    (%eax),%eax
8010830b:	83 e0 01             	and    $0x1,%eax
8010830e:	85 c0                	test   %eax,%eax
80108310:	75 07                	jne    80108319 <uva2ka+0x2f>
    return 0;
80108312:	b8 00 00 00 00       	mov    $0x0,%eax
80108317:	eb 22                	jmp    8010833b <uva2ka+0x51>
  if((*pte & PTE_U) == 0)
80108319:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010831c:	8b 00                	mov    (%eax),%eax
8010831e:	83 e0 04             	and    $0x4,%eax
80108321:	85 c0                	test   %eax,%eax
80108323:	75 07                	jne    8010832c <uva2ka+0x42>
    return 0;
80108325:	b8 00 00 00 00       	mov    $0x0,%eax
8010832a:	eb 0f                	jmp    8010833b <uva2ka+0x51>
  return (char*)P2V(PTE_ADDR(*pte));
8010832c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010832f:	8b 00                	mov    (%eax),%eax
80108331:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108336:	05 00 00 00 80       	add    $0x80000000,%eax
}
8010833b:	c9                   	leave  
8010833c:	c3                   	ret    

8010833d <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
8010833d:	55                   	push   %ebp
8010833e:	89 e5                	mov    %esp,%ebp
80108340:	83 ec 18             	sub    $0x18,%esp
  char *buf, *pa0;
  uint n, va0;

  buf = (char*)p;
80108343:	8b 45 10             	mov    0x10(%ebp),%eax
80108346:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(len > 0){
80108349:	eb 7f                	jmp    801083ca <copyout+0x8d>
    va0 = (uint)PGROUNDDOWN(va);
8010834b:	8b 45 0c             	mov    0xc(%ebp),%eax
8010834e:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108353:	89 45 ec             	mov    %eax,-0x14(%ebp)
    pa0 = uva2ka(pgdir, (char*)va0);
80108356:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108359:	83 ec 08             	sub    $0x8,%esp
8010835c:	50                   	push   %eax
8010835d:	ff 75 08             	push   0x8(%ebp)
80108360:	e8 85 ff ff ff       	call   801082ea <uva2ka>
80108365:	83 c4 10             	add    $0x10,%esp
80108368:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if(pa0 == 0)
8010836b:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
8010836f:	75 07                	jne    80108378 <copyout+0x3b>
      return -1;
80108371:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80108376:	eb 61                	jmp    801083d9 <copyout+0x9c>
    n = PGSIZE - (va - va0);
80108378:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010837b:	2b 45 0c             	sub    0xc(%ebp),%eax
8010837e:	05 00 10 00 00       	add    $0x1000,%eax
80108383:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(n > len)
80108386:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108389:	3b 45 14             	cmp    0x14(%ebp),%eax
8010838c:	76 06                	jbe    80108394 <copyout+0x57>
      n = len;
8010838e:	8b 45 14             	mov    0x14(%ebp),%eax
80108391:	89 45 f0             	mov    %eax,-0x10(%ebp)
    memmove(pa0 + (va - va0), buf, n);
80108394:	8b 45 0c             	mov    0xc(%ebp),%eax
80108397:	2b 45 ec             	sub    -0x14(%ebp),%eax
8010839a:	89 c2                	mov    %eax,%edx
8010839c:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010839f:	01 d0                	add    %edx,%eax
801083a1:	83 ec 04             	sub    $0x4,%esp
801083a4:	ff 75 f0             	push   -0x10(%ebp)
801083a7:	ff 75 f4             	push   -0xc(%ebp)
801083aa:	50                   	push   %eax
801083ab:	e8 3f cf ff ff       	call   801052ef <memmove>
801083b0:	83 c4 10             	add    $0x10,%esp
    len -= n;
801083b3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801083b6:	29 45 14             	sub    %eax,0x14(%ebp)
    buf += n;
801083b9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801083bc:	01 45 f4             	add    %eax,-0xc(%ebp)
    va = va0 + PGSIZE;
801083bf:	8b 45 ec             	mov    -0x14(%ebp),%eax
801083c2:	05 00 10 00 00       	add    $0x1000,%eax
801083c7:	89 45 0c             	mov    %eax,0xc(%ebp)
  while(len > 0){
801083ca:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
801083ce:	0f 85 77 ff ff ff    	jne    8010834b <copyout+0xe>
  }
  return 0;
801083d4:	b8 00 00 00 00       	mov    $0x0,%eax
}
801083d9:	c9                   	leave  
801083da:	c3                   	ret    

801083db <pgflt_hdl>:
// Blank page.
//PAGEBREAK!
// Blank page.
//PAGEBREAK!
// Blank page.
 void pgflt_hdl(){
801083db:	55                   	push   %ebp
801083dc:	89 e5                	mov    %esp,%ebp
801083de:	83 ec 18             	sub    $0x18,%esp

  struct proc *p = myproc();
801083e1:	e8 f6 be ff ff       	call   801042dc <myproc>
801083e6:	89 45 f4             	mov    %eax,-0xc(%ebp)
  uint fault_addr = PGROUNDDOWN(rcr2()); // 获取触发缺页的地址 PGROUNDDOWN用以对齐
801083e9:	e8 19 f3 ff ff       	call   80107707 <rcr2>
801083ee:	25 00 f0 ff ff       	and    $0xfffff000,%eax
801083f3:	89 45 f0             	mov    %eax,-0x10(%ebp)

  // 检查地址是否合法 xv6栈地址是低到高
  if(fault_addr >= p->sz || fault_addr < p->tf->esp) {
801083f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801083f9:	8b 00                	mov    (%eax),%eax
801083fb:	39 45 f0             	cmp    %eax,-0x10(%ebp)
801083fe:	73 0e                	jae    8010840e <pgflt_hdl+0x33>
80108400:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108403:	8b 40 18             	mov    0x18(%eax),%eax
80108406:	8b 40 44             	mov    0x44(%eax),%eax
80108409:	39 45 f0             	cmp    %eax,-0x10(%ebp)
8010840c:	73 2a                	jae    80108438 <pgflt_hdl+0x5d>
    cprintf("pid %d %s: page fault on %x\n", p->pid, p->name, fault_addr);
8010840e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108411:	8d 50 6c             	lea    0x6c(%eax),%edx
80108414:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108417:	8b 40 10             	mov    0x10(%eax),%eax
8010841a:	ff 75 f0             	push   -0x10(%ebp)
8010841d:	52                   	push   %edx
8010841e:	50                   	push   %eax
8010841f:	68 0c 8c 10 80       	push   $0x80108c0c
80108424:	e8 d7 7f ff ff       	call   80100400 <cprintf>
80108429:	83 c4 10             	add    $0x10,%esp
    p->killed = 1;
8010842c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010842f:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
    return;
80108436:	eb 4c                	jmp    80108484 <pgflt_hdl+0xa9>
  }

  // 分配一页内存
  if(allocuvm(p->pgdir,fault_addr,fault_addr+PGSIZE) == 0){
80108438:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010843b:	8d 90 00 10 00 00    	lea    0x1000(%eax),%edx
80108441:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108444:	8b 40 04             	mov    0x4(%eax),%eax
80108447:	83 ec 04             	sub    $0x4,%esp
8010844a:	52                   	push   %edx
8010844b:	ff 75 f0             	push   -0x10(%ebp)
8010844e:	50                   	push   %eax
8010844f:	e8 f2 fa ff ff       	call   80107f46 <allocuvm>
80108454:	83 c4 10             	add    $0x10,%esp
80108457:	85 c0                	test   %eax,%eax
80108459:	75 1a                	jne    80108475 <pgflt_hdl+0x9a>
    p->killed = 1;  // with no lock
8010845b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010845e:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
    switchuvm(p);
80108465:	83 ec 0c             	sub    $0xc,%esp
80108468:	ff 75 f4             	push   -0xc(%ebp)
8010846b:	e8 fa f7 ff ff       	call   80107c6a <switchuvm>
80108470:	83 c4 10             	add    $0x10,%esp
    return;
80108473:	eb 0f                	jmp    80108484 <pgflt_hdl+0xa9>
  }

  // 刷新TLB
  switchuvm(p);
80108475:	83 ec 0c             	sub    $0xc,%esp
80108478:	ff 75 f4             	push   -0xc(%ebp)
8010847b:	e8 ea f7 ff ff       	call   80107c6a <switchuvm>
80108480:	83 c4 10             	add    $0x10,%esp
  return;
80108483:	90                   	nop
80108484:	c9                   	leave  
80108485:	c3                   	ret    
